The Altaz Mariners (French Translation)

Discuss and coordinate development of mainline and user-made content translations.

Moderator: Forum Moderators

Post Reply
User avatar
Bob_The_Mighty
Posts: 824
Joined: July 13th, 2006, 1:15 pm

The Altaz Mariners (French Translation)

Post by Bob_The_Mighty »

I'm opening this thread on behalf of krotop who has made a start translating mine and jb's campaign The Altaz Mariners.

I know nothing about how translations work in Wesnoth, so I have a few general questions.

1. Is there any tools or methods we should know about?
2. How does one load a French version of the campaign rather than the English one?
3. How do we incorporate the translation into our add-on file structure?

Any help would be appreciated. The only general info I have found pertains to translating mainline content, so I'm in the dark about how it should work for add-ons.

One more thing. Due to the size of our campaign and the amount of dialogue, krotop has suggested we seek another translator to help complete the task. If there is anyone who fancies helping out please get in touch.
My current projects:
MP pirate campaign: The Altaz Mariners
RPG sequel: Return to Trent
MP stealth campaign: Den of Thieves
User avatar
Espreon
Developer
Posts: 630
Joined: June 9th, 2007, 4:08 am

Re: The Altaz Mariners (French Translation)

Post by Espreon »

Most of what you need to know is described here: http://wiki.wesnoth.org/WesCamp

Note that you don't really need to use WesCamp if you don't wish to, but you probably should unless you know how to deal with translation tools.

The compiled translation files go into your campaign's "translations" directory. Byspel for a French translation: "translations/fr/LC_MESSAGES/<textdomain>.mo"

Translations for UMC are loaded when whatever language is set as the preferred language. So, if the French translation is active, all UMC French translations will be loaded.
User avatar
pyrophorus
Posts: 513
Joined: December 1st, 2010, 12:54 pm

Re: The Altaz Mariners (French Translation)

Post by pyrophorus »

Bob_The_Mighty wrote: One more thing. Due to the size of our campaign and the amount of dialogue, krotop has suggested we seek another translator to help complete the task. If there is anyone who fancies helping out please get in touch.
I think I can help here. Let me know how.
Friendly,
LS
Campaign Return to Noelren *** HowTos: WML filtering, WML variables
Please help to to update the Guide to UMC Campaigns
User avatar
Bob_The_Mighty
Posts: 824
Joined: July 13th, 2006, 1:15 pm

Re: The Altaz Mariners (French Translation)

Post by Bob_The_Mighty »

Espreon wrote:The compiled translation files go into your campaign's "translations" directory. Byspel for a French translation: "translations/fr/LC_MESSAGES/<textdomain>.mo"
I don't quite follow this, do you know a good example of an add-on with translations that I can download and poke around in?
pyrophorus wrote: I think I can help here. Let me know how.
Excellent! I shall PM you shortly once I've got my head around how best to proceed.
My current projects:
MP pirate campaign: The Altaz Mariners
RPG sequel: Return to Trent
MP stealth campaign: Den of Thieves
User avatar
pyrophorus
Posts: 513
Joined: December 1st, 2010, 12:54 pm

Re: The Altaz Mariners (French Translation)

Post by pyrophorus »

Bob_The_Mighty wrote:
Espreon wrote:The compiled translation files go into your campaign's "translations" directory. Byspel for a French translation: "translations/fr/LC_MESSAGES/<textdomain>.mo"
I don't quite follow this, do you know a good example of an add-on with translations that I can download and poke around in?
I investigate myself on the topic, and maybe all this can be a bit more explained. (I hope Espreon will correct if I missed something).

Wesnoth uses a standard GNU tool named gettext. The big picture is really simple: in the source code, one can mark the translatable strings pre-pending them with an underscore. Then, instead of using the string as it is, a function is called which returns instead the translated one, according to the application or system language setting. When available of course, if not, returns the original string. (OK, I know, things are not so simple, but I just want to describe the work-flow here. Full details can be found at:http://www.gnu.org/software/gettext/manual/)

Now the building of a localized application is a four stage process:
1- First: preparing source code. In Wesnoth, it's pre-pending an underscore to any translatable string and setting a #textdomain directive at the very beginning of each source file. (Look at the link given by Espreon above, it's explained with all details).
2- Run on the source code a tool which extracts translatable strings in a new .pot file. From this file are created several .po files, each related to a particular langage.
3- Translate the strings editing the .po files. They contains entries for each string like this one:

Code: Select all

#. [campaign]: id=Trinity
#: Trinity/_main.cfg:21
msgid "Easy"
msgstr "Facile"
msgid contains the original string and msgstr is empty when the file is created. It should be filled with the translated string as in example above: easy->facile. This can be done editing directly the file, but specialised editors can make your translator life much easier (poedit for instance).

4- compile this .po file to binary format (.mo file) and move it to a special folder in the path of your application. In Wesnoth, this is the "translation" folder. Look at one of those (in the mainline campaigns for instance) to see exactly where to create these folders. In the Trinity example above, the .mo file should be in:
../add_ons/Trinity/translations/fr/LC_MESSAGES/Trinity.mo
assuming the #textdomain directive is set to #textdomain wesnoth-Trinity in source files.
Run Wesnoth, clear the cache, and select correct language setting to test.

Then, assuming step one is complete, content designers have two ways to do things:
1-Do things by themselves.
2-Use the Wescamp facility.

Step two can be done with the wmlxgettext program which can be found in the tools folder of standard Wesnoth distribution. This is necessary because WML is not (yet :D ) a language known in gettext world, and some manipulations must be done on the code (expanding macros for instance) before extracting.
Instead, you can insert the key 'translate=true' in your .pbl file. The add_ons server will do that for you. Where are the .po files then ? On a SVN repository, sorted by language (http://gettext.wesnoth.org/), so anyone can work on translation. Nice, isn't it ?

Step four is rather easy: if you uses poedit, it creates automatically the .mo file each time you save your work. Then you move the .mo file in the right folder of your add_on, select the language in Wesnoth preferences and you're done. Next time you upload the add_on, the translation will be available. If using Wescamp, you must commit the .po file updated (but read carefully guidelines first, it's a team work here), and AFAICS, mysterious and devoted little dwarfs create the .mo file and put it directly in the right location on the add_on server. (Great!)

Updates.
One can imagine easily gettext uses the .mo file as a dictionary. In this dictionary, the search key is the original string itself. So if you change the original string in your code, translated strings related to can't be found any more. So you must extract changes, update the .po files, find the orphan translated strings and link them again to the new original. It can be a lot of work.

Extracting changes and updating .po files (without losing all previous work) is a little more tricky than creating files from scratch. So it's probably better to:
- Begin translation only when your add-on is mature.
- Use Wescamp facility: our tireless little dwarfs take care of updates too ! (Praise them with great praises !)

HTH,

LS
Campaign Return to Noelren *** HowTos: WML filtering, WML variables
Please help to to update the Guide to UMC Campaigns
User avatar
Espreon
Developer
Posts: 630
Joined: June 9th, 2007, 4:08 am

Re: The Altaz Mariners (French Translation)

Post by Espreon »

Bob_The_Mighty wrote: I don't quite follow this, do you know a good example of an add-on with translations that I can download and poke around in?
The Era of Magic is a good example.
pyrophorus wrote: In the Trinity example above, the .mo file should be in:
../add_ons/Trinity/translations/fr/LC_MESSAGES/Trinity.mo
assuming the #textdomain directive is set to #textdomain wesnoth-Trinity in source files.
Run Wesnoth, clear the cache, and select correct language setting to test.
Actually, it should be "wesnoth-Trinity.mo" since the textdomain is "wesnoth-Trinity". Also, I don't think flushing the cache is necessary on most setups.

Step two can be done with the wmlxgettext program which can be found in the tools folder of standard Wesnoth distribution. This is necessary because WML is not (yet :D ) a language known in gettext world, and some manipulations must be done on the code (expanding macros for instance) before extracting.
Well, actually, it's much easier to use the stuff from WesCamp to generate and manage the translation files. But of course, that stuff can really only be used on a Linux or other Unix-like system. If Bob really wishes to manage the translations himself, I'll gladly tell him.
If using Wescamp, you must commit the .po file updated (but read carefully guidelines first, it's a team work here), and AFAICS, mysterious and devoted little dwarfs create the .mo file and put it directly in the right location on the add_on server. (Great!)
Actually, either the add-on server insertion stuff never worked or it is broken. And since mordante/SkeletonCrew hasn't the time to fix it... yeah.
AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Re: The Altaz Mariners (French Translation)

Post by AI »

The insertion stuff is supposed to happen, but it has been broken for years. From what I can tell in the campaign server sources, they're all scripts on the server somewhere.
Post Reply