Translation guide (Not finished.)

Discuss, plan, and make Translations for FreeOrion
Message
Author
User avatar
Cjkjvfnby
AI Contributor
Posts: 539
Joined: Tue Jun 24, 2014 9:55 pm

Translation guide (Not finished.)

#1 Post by Cjkjvfnby »

I suggest to use next workflow to translation:
  • Download and install python 2.7 if you don't have one.
  • Download script https://raw.githubusercontent.com/Cjkjv ... s/parse.py
  • Google how to run python script with arguments on you system (usually you need open console and paste text from script example)
  • Create full string file with all tokens present in en.txt (I use ru.txt as example you need to choose your language)

    Code: Select all

    python parse.py full ru.txt full_ru.txt
  • Do all translation staff with full_ru.txt
  • Convert it back to small file

    Code: Select all

    python  parse.py small full_ru.txt ru.txt
  • Post new file or diff for you file and trunk to forum.
Terms:
  • key: ingame key for object. It is written in capital letters separated with underscore. (ENVIRONMENTAL_PREFERENCES). Values can have references to other value by its key. Keys should never be translated.
  • value: text that will be shown in GUI instead of key. (Environmental Preferences:). Value can be single line or multi line. Multi line values should be wrapped to triple single quotes: ('''hello it is wrapped value'''). There is not exact rule about spaces at the end of value, this should be done according to current content.
  • reference: will be replaced by text stored by key. Link to missed key it prohibited

    Code: Select all

    [[AVERAGE_INDUSTRY]]
  • links: will be replaces by clickable link to pedia. It is consist of pedia section and title in section see examples:

    Code: Select all

    [[encyclopedia ORGANIC_SPECIES_TITLE]]
    [[tech LRN_XENOARCH]]
    [[buildingtype BLD_CONC_CAMP]]
    [[special ANCIENT_RUINS_SPECIAL]]
    [[shippart GT_TROOP_POD]]
    [[shiphull SH_NANOROBOTIC]]
    [[predefinedshipdesign SM_KRILL_1]]
    
Best practices:
  • In text file you should have only translated items. Leaving English text in translation is bad. en.txt is changing constantly and values will be desynced. Files already have some desynced values, feel free to remove them.
  • If value ends with space wrap it to triple quotes. This will allow to notice it.
  • Use reference and links there it is possible. This will reduce amount of text to translate.
  • Make translation look uniform in game.
Text tags:
Here is description of possible tags: https://github.com/freeorion/freeorion/ ... ont.h#L108
I check them in message window and in pedia. I don't know does it works in other places.

upd: Here you can find full files https://github.com/Cjkjvfnby/freeorion/ ... ringtables I will update it time to time or by request.
Last edited by Cjkjvfnby on Sun Apr 05, 2015 8:50 am, edited 4 times in total.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Translation guide (Not finished.)

#2 Post by Dilvish »

Thanks for the writeup Cjkjvfnby. To make it still a little easier on folks could you add an extra detail in the download script step, letting people know to use the 'Raw' button on the righthand side of the page you linked to, in order to get the plain python file. Perhaps also note that the install python 2.7 step is only if they don't already have it. If they are playing FO they probably DO have it, but may not be aware of that.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Cjkjvfnby
AI Contributor
Posts: 539
Joined: Tue Jun 24, 2014 9:55 pm

Re: Translation guide (Not finished.)

#3 Post by Cjkjvfnby »

Dilvish wrote:Thanks for the writeup Cjkjvfnby. To make it still a little easier on folks could you add an extra detail in the download script step, letting people know to use the 'Raw' button on the righthand side of the page you linked to, in order to get the plain python file. Perhaps also note that the install python 2.7 step is only if they don't already have it. If they are playing FO they probably DO have it, but may not be aware of that.
Done.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Cjkjvfnby
AI Contributor
Posts: 539
Joined: Tue Jun 24, 2014 9:55 pm

Re: Translation guide (Not finished.)

#4 Post by Cjkjvfnby »

I updated full text files in my repo. https://github.com/Cjkjvfnby/freeorion/ ... ringtables

As side effect of this you can check what was changed since last update.

To get list of commits you need click on file and press history. https://github.com/freeorion/freeorion/ ... les/de.txt
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Translation guide (Not finished.)

#5 Post by Dilvish »

CJ, in one of your recent Pull Requests, you reference this thread and do some stringtable cleanup, including removing any double blank lines. There are a number of places where the extra whitespace seems to me to improve organization (plus, I don't see that rule above), and so I'd like to discuss it a bit more and see other people's opinions.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Cjkjvfnby
AI Contributor
Posts: 539
Joined: Tue Jun 24, 2014 9:55 pm

Re: Translation guide (Not finished.)

#6 Post by Cjkjvfnby »

Dilvish wrote:CJ, in one of your recent Pull Requests, you reference this thread and do some stringtable cleanup, including removing any double blank lines.
No any only between seqtions. I will check late if it is not true.
There are a number of places where the extra whitespace seems to me to improve organization (plus, I don't see that rule above), and so I'd like to discuss it a bit more and see other people's opinions.
It is in best practice section:
If value ends with space wrap it to triple quotes. This will allow to notice it.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Translation guide (Not finished.)

#7 Post by Dilvish »

Cjkjvfnby wrote:It is in best practice section:
If value ends with space wrap it to triple quotes. This will allow to notice it.
This doesn't really seem applicable-- if a value did have any blank lines within it (whether single or double), I believe it would already have to be enclosed in triple quotes. But that's not really what I was referring to anyway. I hadn't noticed any values where I wanted to preserve double blank lines within them; I was responding to your description in the PR which sounded like it meant removing all double blank lines. If you are going to leave in ones that separate sections, then it all sounds fine to me.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Oberlus
Cosmic Dragon
Posts: 5704
Joined: Mon Apr 10, 2017 4:25 pm

Re: Translation guide (Not finished.)

#8 Post by Oberlus »

I have a doubt about what to do when the translation of a key value is exactly the same as the English value.

Dummy example:

Code: Select all

OK
Ok
I mean, English and Spanish will use the same word.

Another example:

Code: Select all

DESC_AND_BEFORE_SINGLE_OPERAND
''''''
I asked this before and got this answer:
adrian_broher wrote: Thu Apr 09, 2020 4:21 pm
When an English entry and the Spanish translation are the same, should I not include them in the Spanish string table?
Its best to let st-tool handle that. It prepares the string table for the workflow Ouaz wrote down some time ago.
So I followed Marcel's instructions and I got entries to translate that are as I explain above.

But I think I've read somewhere that "untranslated" keys should not be included. Sometimes I acknowledge that refers to entries pending of translation, but I am unsure about entries that do not require translation.
If I use my brains, I think the right answer is to include such entries in the translated stringtable (in this case es.txt), because that way the client doesn't have to search for it in the local stringtable and look for it again in the English stringtable if not found.

Is that reasoning correct?


This seemed the right place for this question. Apologies if it is not.

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: Translation guide (Not finished.)

#9 Post by adrian_broher »

But I think I've read somewhere that "untranslated" keys should not be included. Sometimes I acknowledge that refers to entries pending of translation, but I am unsure about entries that do not require translation.
If I use my brains, I think the right answer is to include such entries in the translated stringtable (in this case es.txt), because that way the client doesn't have to search for it in the local stringtable and look for it again in the English stringtable if not found.
I don't see a reason to include those entries. The lookup time is neglible and doesn't happen often (usually only once during the creation or invalidation of a UI widget.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
LienRag
Cosmic Dragon
Posts: 2103
Joined: Fri May 17, 2019 5:03 pm

Re: Translation guide (Not finished.)

#10 Post by LienRag »

Shouldn't translations be done with .po files ?
(I had one workshop where we used these but wasn't really managing them myself, so I'm certainly not an expert, but AFAIK it's the standard for translation projects nowadays)

User avatar
Ouaz
Dyson Forest
Posts: 232
Joined: Wed Aug 13, 2014 7:21 pm
Location: France

Re: Translation guide (Not finished.)

#11 Post by Ouaz »

LienRag wrote: Sun Apr 18, 2021 9:19 pm Shouldn't translations be done with .po files ?
(I had one workshop where we used these but wasn't really managing them myself, so I'm certainly not an expert, but AFAIK it's the standard for translation projects nowadays)
Actually, for the moment with FO, txt files are easier to handle, especially given the huge text and translation stuff.

- More convenient to compare and maintain stringtable files for translators (I wrote a post about this years ago > viewtopic.php?f=27&t=9463&p=77199&hilit=meld#p77199)
- More convenient to check translations in-game and on the fly (number of words, contextual translation, etc). It only requires to modify the txt file, then use "Flush stringtables" in FO, et voilà.
- It's way more convenient for proofreading, use of regex, etc.

I worked with .po files on other projects (with PoEdit). Works well when there's not a lot of lines, and the translation context is not very important (mainly website translation).

But I can't imagine how troublesome it would be with FO. :mrgreen:

However, in a (very) distant future, when FO will be on final beta version, .po files could be eventually used. :P
I release every updated file under the CC-BY-SA 3.0 license.

User avatar
stpa
Space Kraken
Posts: 157
Joined: Mon Mar 12, 2018 1:08 pm

Re: Translation guide (Not finished.)

#12 Post by stpa »

can i revive the discussion please. i would prefer to use Ωt for translation. it is _the_ open source translators tool, has lots of built in support features for translators, does the git stuff itself, supports 'team projects' with multiple collaborators, one repository per target localization, set up some after-commit-scripting both in freeorion normal repository to convert from existing strings files to xliff which is a very simple industry standard for internationalization/localization to push updates of original (english) texts as translation-source to all target-localization-repositories, and in the target localization repositories some after-commit-script to auto-translate the current xliff with the current translation memory and convert back to translated target text files. or maybe not auto-commit but some sort of review-process. the translators would have an instance of omegaT running, log in their target-locale-repository, do some translating, and omegaT takes care of commits and synching and so on, would have nice reviewable commits, could make notes and comments about translations, can handle identical translations, does fuzzy matching, can import translation memories generated by other open source projects to propose reusable translations, can do lots of stuff with the okapi automation, .. just a thought.

User avatar
Cjkjvfnby
AI Contributor
Posts: 539
Joined: Tue Jun 24, 2014 9:55 pm

Re: Translation guide (Not finished.)

#13 Post by Cjkjvfnby »

stpa wrote: Sun Jan 23, 2022 10:36 am can i revive the discussion please. i would prefer to use Ωt for translation. it is _the_ open source translators tool, has lots of built in support features for translators, does the git stuff itself, supports 'team projects' with multiple collaborators, one repository per target localization, set up some after-commit-scripting both in freeorion normal repository to convert from existing strings files to xliff which is a very simple industry standard for internationalization/localization to push updates of original (english) texts as translation-source to all target-localization-repositories, and in the target localization repositories some after-commit-script to auto-translate the current xliff with the current translation memory and convert back to translated target text files. or maybe not auto-commit but some sort of review-process. the translators would have an instance of omegaT running, log in their target-locale-repository, do some translating, and omegaT takes care of commits and synching and so on, would have nice reviewable commits, could make notes and comments about translations, can handle identical translations, does fuzzy matching, can import translation memories generated by other open source projects to propose reusable translations, can do lots of stuff with the okapi automation, .. just a thought.
Looks like an interesting tool. I'll try to play with it. Are you using this tool for your project?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
stpa
Space Kraken
Posts: 157
Joined: Mon Mar 12, 2018 1:08 pm

Re: Translation guide (Not finished.)

#14 Post by stpa »

Cjkjvfnby wrote: Sun Feb 06, 2022 10:15 pm Are you using this tool for your project?
well i was thinking about how to get it going for FO anayway - as outlined above, needs a simple converter from current .txt format to xliff-format and back to be fully compatible. and such converter is easy, there is format validation already so can just rewrite such methods for conversion instead of validation, xliff specs are totally simple - <xliff><file name=xx sourcelanguage=xx targetlanguage=xx><tu id=xx><tuv source>Source</tuv><tuv target>Источник</tuv><note>Comment</note></tu><tu> ... </tu></file></xliff> - more or less without having consulted the actual standard but something very simple along those lines. and then that xliff can be worked on with omegaT easy as π .. i'll try and maybe set something up for myself to be able to work properly on translations, and if it's only local, and then convert back to the usual .txt's for pr's and review. maybe.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13586
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Translation guide (Not finished.)

#15 Post by Geoff the Medio »

stpa wrote: Mon Feb 07, 2022 5:47 pm<xliff><file name=xx sourcelanguage=xx targetlanguage=xx><tu id=xx><tuv source>Source</tuv><tuv target>Источник</tuv><note>Comment</note></tu><tu> ... </tu></file></xliff>
How will it react to;
- XML-like tags in the stringtable, like <rgba 0 255 0 255>(PASSED)</rgba> or Special <i>%2%</i>
- unpaired XML-like tags within a stringtable entry (ie. when used in a macro)
- unpaired < or > like [[PE_UNINHABITABLE]] < [[PE_HOSTILE]] < [[PE_POOR]] < [[PE_ADEQUATE]] < [[PE_GOOD]] or (Max Fuel < 1.0)
- multibyte characters like ?

Post Reply