Page 1 of 2

How to translate?

Posted: Wed Oct 30, 2013 3:52 pm
by zchronos
Hi!

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

- I know about Renpy and Python Programming.

Re: How to translate?

Posted: Fri Nov 01, 2013 2:26 am
by Spiky Caterpillar
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.).

Re: How to translate?

Posted: Sat Nov 02, 2013 2:58 am
by zchronos
Great! Thanks.

Re: How to translate?

Posted: Wed Nov 13, 2013 2:09 pm
by Spiky Caterpillar
I put an experimental patch that adds translation hooks up at http://spikycaterpillar.com/long_live_t ... anslation/ .

Re: How to translate?

Posted: Wed Nov 13, 2013 3:43 pm
by zchronos
Thanks!. The patch works.
Image

But this don't works with the names (Joslyn, King Dowager, Duke or Caloris).

Re: How to translate?

Posted: Wed Nov 13, 2013 4:22 pm
by Spiky Caterpillar
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)

Re: How to translate?

Posted: Wed Nov 13, 2013 4:38 pm
by zchronos
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.

Re: How to translate?

Posted: Mon Dec 23, 2013 7:14 am
by zchronos
[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.

Re: How to translate?

Posted: Mon Dec 23, 2013 5:24 pm
by Ohana
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.

Code: Select all

#!/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).

Re: How to translate?

Posted: Mon Jan 06, 2014 2:18 am
by onigi
Nice thread. :D
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.

Re: How to translate?

Posted: Mon Jan 06, 2014 8:50 am
by Ohana
onigi wrote:Nice thread. :D
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.

Code: Select all

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

Re: How to translate?

Posted: Tue Jan 07, 2014 12:09 am
by onigi
thank you so much! I did it.

Re: How to translate?

Posted: Tue Jan 07, 2014 1:06 am
by Ohana
I am glad I could help!

Re: How to translate?

Posted: Tue Jan 07, 2014 8:39 am
by 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?

Re: How to translate?

Posted: Tue Jan 07, 2014 9:13 am
by Ohana
Derevo wrote: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 this thread 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.