Hanako Games

News, Walkthroughs, and Chat about Anime Games

How to translate?


zchronos

How to translate?

#1 by zchronos - Oct 30 2013

Hi!

I want translate LLTQ to Spanish. Can you help me?

- I know about Renpy and Python Programming.
My blog: Bishoujolinux
Linux user #460594

Spiky Caterpillar

Re: How to translate?

#2 by Spiky Caterpillar - Nov 1 2013

Hola! At the moment, we're busy prepping for a release, but once that's done I can probably help with translation. (We've got a framework for language-switching in Science Girls, I just need to make sure it plays nice with LLtQ and possibly add a couple of features.).

zchronos

Re: How to translate?

#3 by zchronos - Nov 2 2013

Great! Thanks.
My blog: Bishoujolinux
Linux user #460594

Spiky Caterpillar

Re: How to translate?

#4 by Spiky Caterpillar - Nov 13 2013

I put an experimental patch that adds translation hooks up at http://spikycaterpillar.com/long_live_the_queen/translation/ .

zchronos

Re: How to translate?

#5 by zchronos - Nov 13 2013

Thanks!. The patch works.


But this don't works with the names (Joslyn, King Dowager, Duke or Caloris).
My blog: Bishoujolinux
Linux user #460594

Spiky Caterpillar

Re: How to translate?

#6 by Spiky Caterpillar - Nov 13 2013

Translating the names works for me, though I did find some other bugs in the patch. (Fixed and uploaded)

Turn on logging and see if it provides any more info? (It also dumps errors to stdout)

zchronos

Re: How to translate?

#7 by zchronos - Nov 13 2013

Nice, now I can translate the names and the game save the language.

[UPDATE]
I've created a repository in bitbucket. Is a private repository (for now).
https://bitbucket.org/zchronos/lltq_es

I like give you access, but I need your username in bitbucket for this.

NOTE:
The most hard is write all the English text EXACT, because some lines have styles (black) and {b}Conversation.{/b} is different to {b}Conversation{/b}. and {b} Conversation.{/b}. This takes many time. Maybe you can help with the translations making COPY/PASTE of the text, so I can concentrate on the translation and if another person want translate to ger/rus/jap will easier.
My blog: Bishoujolinux
Linux user #460594

zchronos

Re: How to translate?

#8 by zchronos - Dec 23 2013

[UPDATE 2]
Now the repository is public. Because I don't have the original texts, the translation is SLOW and VERY HARD. If someone want help me, just to type the English exact text, that would be very helpful for me.

So far I have translated to week 2 (some characters, menus, etc), BUT some lines of text don't works (maybe the text is not exact).

Note: Sorry for the double post.
My blog: Bishoujolinux
Linux user #460594

Ohana

Re: How to translate?

#9 by Ohana - Dec 23 2013

I may be able to help out with getting the original English script lines dumped into a file, but I imagine it would be pretty effortless for spiky or someone else with scripting/coding skills and access to the original game scripts to run a few regular expressions that would dump all the text of the game into a single file that could act as a translation base.

EDIT: A quick and dirty python script that can dump the lines from "The Question" into a file suitable for translation. It needs to be run from the directory with the game-specific uncompiled scripts to work.
#!/usr/bin/env python
import os, codecs

#Single word renpy keywords that when detected will exclude the line in question
rpy_keywords = ["init","init:","layout","widget","widget_hover","widget_text","widget_selected","disabled","disabled_text","button_menu","rounded_window","mm_root","gm_root","(",")","python","python:","frame","image","define","label","scene","play","$","with","menu:","jump","show","hide","if","return","pos","anchor","def"]

#Words used to denote configuration settings. Any lines starting with one of these words will be excluded (more flexible matching pattern than the previous list...will conflict with character defines that start with a word in the list, so prefer the above list if possible)
rpy_configwords = ["config.","layout.","theme.","build.","(",")"]

#For some reason, renpy seems to work with utf-8 files with a BOM. It may be safe to use "utf-8" instead of "utf-8-sig"
outfile = codecs.open("tl_base", "w", "utf-8-sig")

#Checks if a line is actually a script text line. Unfortunately, if it is not a simple quoted line, we have to disqualify it from being anything else renpy uses internally before deciding if it is a character line. Parsing defines could work around this, but it would require making it into a two-pass process similar to how renpy itself reads the scripts when running an uncompiled game.
def isvalid(line):
    if (line.strip().startswith("#") or line.strip().startswith("'")):
        return False
    elif line.strip().startswith('"'):
        return True
    elif len(line.strip()) == 0:
        return False
    else:
        for word in rpy_configwords:
            if line.strip().startswith(word):
                return False
    if not len(line.split("=")) > 0:
        if not (line.strip().split()[0] in rpy_keywords):
            return True
    return False    
    
#Removes quotes from the script line
def clean(input_line):
    #work-around for escaped inline quotes
    line = input_line.strip().replace(r'\"',"$quote$")
    print(line)
    if line.startswith('"'):
        return line.strip('",:)')
    else:
        return ''.join(line.split('"')[1]).replace("$quote$",r'\"')
    
#Pushes the line out to out tl_base output file, followed by a blank line which should contain the translated text later
def writeout(cleanline):
    outfile.write(cleanline)
    outfile.write("\n\n")
    outfile.flush()
    
#Iterates through an individual file and dumps its contents
def parsefile(file):
    for line in file.readlines():
        #Lazy error handling...should not come up often and I don't have a script handy that will trip this error. Should not come up at all when dumping English game scripts and this is a debugging feature rather than something that affects the output file
        try:
            print(line)
        except:
            print("---line contains characters that cannot be printed on the console---")
        if isvalid(line):
            writeout(clean(line))

#Main program. Finds all .rpy scripts in the folder and passes them on to be parsed by the other functions
for filename in os.listdir(os.getcwd()):
    if filename.endswith(".rpy"):
        print(filename)
        #if you use an external editor to make your game scripts, they might not contain a BOM. Try changing "utf-8-sig" here to just "utf-8" or whatever codepage you have made your scripts in.
        file = codecs.open(filename, "r", "utf-8-sig")
        parsefile(file)

outfile.close()
Script is public domain. Do whatever you want with it.
EDIT2: Added a work-around for escaped inline quotes to the code
EDIT3: Added a few more conditions to disqualify non-dialogue lines. It isn't perfect but it works on some other game scripts with minor hand-tweaking (anything that still has quotation marks in the line needs to be checked manually).

onigi

Re: How to translate?

#10 by onigi - Jan 6 2014

Nice thread. Very Happy
I've started translate LLTQ to japanese and use the translatation support tools, but because the game doesn't have japanese-fonts, I can't check those texts on the game screen yet.
Would you please add the font to game?

Thanks.

Ohana

Re: How to translate?

#11 by Ohana - Jan 6 2014

onigi:

Nice thread. Very Happy
I've started translate LLTQ to japanese and use the translatation support tools, but because the game doesn't have japanese-fonts, I can't check those texts on the game screen yet.
Would you please add the font to game?

Thanks.
Just put your font file and an override rpy script like this into the "game" sub-folder to manually set the font and size for each style...(I think I got most of the styles used in the game added here but I may have missed some). I know there is a way to use an installed system font but I don't know of a good one you can assume everyone has for Japanese text support.
init python:
    style.default.font = "meiryo.ttc"
    style.statstext.font = "meiryo.ttc"
    style.relportraitbox.font = "meiryo.ttc"
    style.relportraitframe.font = "meiryo.ttc"
    style.relportraitname.font = "meiryo.ttc"
    style.relfluffblock.font = "meiryo.ttc"
    style.relstat.font = "meiryo.ttc"
    style.relfluff.font = "meiryo.ttc"
    style.menu_choice_button.font = "meiryo.ttc"
    style.button_text.font = "meiryo.ttc"
    style.studyfluff.font = "meiryo.ttc"
    style.studybold.font = "meiryo.ttc"
    style.statsnum.font = "meiryo.ttc"
    style.selectablebutton.font = "meiryo.ttc"
    style.buttonwhite.font = "meiryo.ttc"
    
    style.default.size = 20
    style.statstext.size = 20
    style.relportraitbox.size = 20
    style.relportraitframe.size = 20
    style.relportraitname.size = 20
    style.relfluffblock.size = 20
    style.relstat.size = 20
    style.relfluff.size = 20
    style.menu_choice_button.size = 20
    style.button_text.size = 20
    style.studyfluff.size = 20
    style.studybold.size = 20
    style.statsnum.size = 20
    style.selectablebutton.size = 20
    style.buttonwhite.size = 20

onigi

Re: How to translate?

#12 by onigi - Jan 7 2014

thank you so much! I did it.

Ohana

Re: How to translate?

#13 by Ohana - Jan 7 2014

I am glad I could help!

Derevo

Re: How to translate?

#14 by Derevo - Jan 7 2014

Hello. I'm currently trying to translate this game to russian, and I have some issues with current version of experimental patch:
1. No support for translated pictures (i.e buttons and skills).
2. No support for character profiles and some menu text.
3. It did not register "\n", which is used in some menu text (i.e "Are you sure you want to return to the main menu? This will lose unsaved progress").
Is this bugs because patch for now is just experimental? Will there be updated version of translate support?

Ohana

Re: How to translate?

#15 by Ohana - Jan 7 2014

Derevo:

Hello. I'm currently trying to translate this game to russian, and I have some issues with current version of experimental patch:
1. No support for translated pictures (i.e buttons and skills).
2. No support for character profiles and some menu text.
3. It did not register "\n", which is used in some menu text (i.e "Are you sure you want to return to the main menu? This will lose unsaved progress").
Is this bugs because patch for now is just experimental? Will there be updated version of translate support?
As for pictures, read up on What about modding? for details on how to override the images. If I get permission I can provide template blanks for all of the bitmap buttons with text, but some may take a while to make due to how they are composited.

Not sure on the rest...maybe Spiky can give more info. Its obvious the translation patch is not complete yet though as Spiky specifically mentions some of its limitations.

Spiky Caterpillar

Re: How to translate?

#16 by Spiky Caterpillar - Feb 1 2014

The translation code is now part of the main game; the newest translation package (at http://spikycaterpillar.com/long_live_the_queen/translation ) has what should be a complete text dump of all the translatable strings in 1.2.19.

Any bugs in the translation code that have not been fixed should be re-reported, as should any strings or images that should be translatable and aren't. I don't currently have hooks to change fonts after language switching, but that could be added.

Translation-related changes:
 * 'subtitution' substituted by 'substitution'.
 * Severin's vote for Elodie is now properly punctuated.
 * Bonus/Penalty indicators on mood in skills screen.
 * It is the people that make this domain great.  (Was 'is it the people'...)
 * Studying... indicator now mentions mood effects.
 * readable_number_small_translations, land_military_desc_translations,
   barracks_report_translations, and readable_number_translations dicts
   added.
 * Treasury reports made translatable (using Novan pluralization rules)
 * Mood-related failure now shows up in study fluff.
 * Several strings that couldn't be translated are now translatable.
 * 'Afraid +1' changed to '+1 Afraid'.
 * 'Transporting large amounts of good upriver' now goods instead.
 * Condemned Man capitalized.
 * The Terrax bluff option is now 'Threaten to ally with Terrax'.
 * Now consistently uses Yieldingess in affected bubbles.
 * +5 Pressure -> +5 Pressured.
 * Extra line feed before 'Your skill in X is now 50...' dialog now trimmed.
 * Moodiness indicator now 'You are too <mood> to focus properly on this
   subject right now.', and shows up as long as you failed to get fluff for
   reasons other than a cap.
 * File save name field should be translatable.
 * Sidebar buttons will now be replaced by
   translations/(lang)/sidebar/(buttname)[-hover].png if present.
 + Translators note: a number of update error and debug messages are not
   translatable at present; I'm undecided on how best to handle translating
   exception names.
 * Title screen button images now translatable, as is preferences text.
 * Logs should now be translatable.
 * Language should be included in tracebacks.
 * Skip Ahead/Stop Skipping buttons; Show Skip Button/Hide Skip Button options;
   skipping seen is now forcibly disabled.
 * Now uses 'Show Log' instead of 'Save Story' on the ending menus.
 * On-screen keyboard now translatable.

onigi

Re: How to translate?

#17 by onigi - Feb 2 2014

What's a gorgeous. Thank you VERY much! It working almost perfectly. Some phrases, however, seem to be still untranslatable. For example, a Study texts, Achievements, Several profile texts and a phrase that includes "/n" weren't applied translated texts.

There is a screenshot I captured. (changing a font by Ohana's scripts)

[Could not load http://gamelogsector.com/files/2014/01/aaa5.jpg]

Many thanks.

Spiky Caterpillar

Re: How to translate?

#18 by Spiky Caterpillar - Feb 3 2014

Okay, study results, strings containing \n, and a few previously-untranslated strings in profiles should be translatable in alpha 1.2.20.1.

I've also fixed a crash when displaying logs that were saved to directories containing non-ASCII characters, at least on my own computer - this should be tested on other peoples' systems, though, since what works on my computer might not work on other peoples'.

onigi

Re: How to translate?

#19 by onigi - Feb 4 2014

Thanks you so much!

Speaking of which, The game crashed when it attempted to displaying a log in previous versions, but in v1.2.20.1, it works correctly now. Very Happy

SenorKaffee

Re: How to translate?

#20 by SenorKaffee - Feb 15 2014

Hm - I tried to start with a German translation, but can't get changes to load into the game.

Deleted the existing de folder, renamend sample to de, changed the name in name from Sample to Deutsch.
At this point loading the translation works, but no step further.

Opened strings, changed "Joslyn, King Dowager, Duke of Caloris" into "Joslyn, Königswitwer, Herzog von Caloris", saved, restarted game and tried to select the Deutsch option, got this error:



It's not the umlaut, I tried avoiding it by using "oe" instead of "ö", but same error. Any ideas?

My version is from Steam.

Spiky Caterpillar

Re: How to translate?

#21 by Spiky Caterpillar - Feb 15 2014

If you upload a zip or tarball of your translation directory somewhere, I can take a look at it.

(Also, you may want to get in touch with the other Deutsch translation group at http://steamcommunity.com/groups/LLTQT/discussions )

Luchsen

Re: How to translate?

#22 by Luchsen - Feb 20 2014

Ohana:

If I get permission I can provide template blanks for all of the bitmap buttons with text, but some may take a while to make due to how they are composited.
That would be nice. Smile

Derevo

Re: How to translate?

#23 by Derevo - Jun 19 2014

We have found that some lines are not translating. What we found:

Main window:
Week
"Current mood: x", "Bonus to: x", "Penalty to: x".

Panel "Classes":
Morning ~ Class Categories
Evening ~ Class Categories
You need to pick both a morning and an evening class.
You need to pick an evening class.
No class selected.
You need to pick a morning class.

Map:
Now that you've finished studying,\nwhat will you do for the weekend?
Button "Mood".

Derevo

Re: How to translate?

#24 by Derevo - Sep 30 2014

Regarding new alpha, is there anything that could, theoretically, break translations?

hanako

Re: How to translate?

#25 by hanako - Sep 30 2014

edit: http://spikycaterpillar.com/long_live_the_queen/changes.html

Spiky Caterpillar

Re: How to translate?

#26 by Spiky Caterpillar - Oct 1 2014

Derevo:

Regarding new alpha, is there anything that could, theoretically, break translations?
There have been typo fixes and some improvements to the dossiers, both of which will need retranslation. The easiest way to get a handle on the changes is probably to go over http://spikycaterpillar.com/long_live_the_queen/translation/translations-1.2.24-1.2.27.diff
which lists all the new lines.

Also the lines that you reported weren't translating should now be translatable.
Hanako forum archive - Topic list