Board index FlightGear The FlightGear project

How to add new translations

Questions about the FlightGear organisation, website, wiki etc.

How to add new translations

Postby rogue-spectre » Sat Dec 20, 2014 5:49 pm

Hi,

I know two people who are using or could use flightgear and i would like to contribute to the translation process for french, in order to help them to use the software. I have seen the translation files that are available into the fgdata/Translations directory, but theese files seemed to be already translated. However a lot of dialog menus (fgdata/gui/dialogs) seem not to be translated and i could use a little help to understand how to create the create the right xml files. For now i have understood that

- fgdata/Translations/locale.xml must contains some references to the xml files located in fgdata/Translations/<locale>
- the fgdata/Translations/en/<file>.xml are the root files, but here i need to know how to create new ones, they contains references to fgdata/gui/dialogs/<files>
- then fgdata/Translations/<locale>/<file>.xml are copies of fgdata/Translations/en/<file>.xml containing the translations

Nice day.
rogue-spectre
 
Posts: 6
Joined: Sat Dec 20, 2014 5:15 pm

Re: How to add new translations

Postby Hooray » Sat Dec 20, 2014 6:16 pm

hi & welcome !

I'd suggest to check out the wiki: http://wiki.flightgear.org/Howto:Translate_FlightGear

Let us know if there's anything missing (and feel free to add your own tips/screen shots, too!)
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11493
Joined: Tue Mar 25, 2008 8:40 am

Re: How to add new translations

Postby rogue-spectre » Sat Dec 20, 2014 7:23 pm

thanks for this quick answer, i have already checked this page and it helped me to know where the translations files are but it is not enought. The point i do not understand is how to create the new english xml files. For instance if i want to translate the "Weather Conditions" dialog box, what are the steps i must do. The string is not present in the current xml english files, so i can't just copy and translate… another steps must be done before, or i'm just missing the obvious ;)
rogue-spectre
 
Posts: 6
Joined: Sat Dec 20, 2014 5:15 pm

Re: How to add new translations

Postby Hooray » Sat Dec 20, 2014 7:56 pm

Subject: Total translation of the simulator in Italian
Hooray wrote:if you're refererring to things like the built-in help dialog, checklists and tutorials etc, those feature are currently not designed to support localization. And that also applies to GUI labels (buttons, text fields)


Subject: language for menu and ui widget
Hooray wrote:The upcoming Canvas GUI -which is work in progress- will be using osgText internally, to fully support UTF-8
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11493
Joined: Tue Mar 25, 2008 8:40 am

Re: How to add new translations

Postby rogue-spectre » Sat Dec 20, 2014 8:08 pm

Ha ! This explains everything… so i can't do it currently, maybe we can add a warning about this in the wiki ? I must check this page http://wiki.flightgear.org/Canvas_GUI, to see when we can start working on it. Thanks
rogue-spectre
 
Posts: 6
Joined: Sat Dec 20, 2014 5:15 pm

Re: How to add new translations

Postby Hooray » Sat Dec 20, 2014 8:26 pm

Yes, please feel free to update the wiki accordingly.
Besides, Canvas GUI dialogs can already be localized easily:

Subject: Canvas GUI: Internationalization (PM response)

Hooray wrote:Responding in public to get more eye balls/people involved:

F-JJTH wrote:I investigated the internationalization problem but did not found any *nice* solution. If you have a solution I would be happy to use it.


We do have $FG_ROOT/Translations obviously - but even that doesn't cover GUI dialogs, as per: Issue #263 ("Language option broken")

So, absent a proper solution, the easiest method would be to avoid hard-coding any strings in your widgets/GUI dialogs and using a hash instead as a lookup map, i.e. one that contains keys/values with a sprintf-style format string:

Code: Select all
var myStrings  = {

DEFAULT: {
 WELCOME: "Welcome %s",
 GOODYBE: "Goodbye !",
}, # default (English)

SPANISH: {
 WELCOME: "Hola %s",
 GOODYBE: "Adios !",

}, # Spanish

};



Your GUI dialogs/widgets, would then simply use the corresponding lookup key, e.g.:
Code: Select all
var LANGUAGE='DEFAULT';
var message = myStrings[ LANGUAGE ].WELCOME;


Note that both, Nasal & Canvas do support utf-8, so this should be much more flexible than our existing GUI.
However, it would make sense to introduce a separate Nasal/Canvas module (file) for this, to keep all similar functionality in a single place.

Using this approach, you would never have to touch any GUI dialogs/widgets for updating language support - i.e., you could even maintain those hashes in corresponding *.local files and include those via io.include()
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11493
Joined: Tue Mar 25, 2008 8:40 am

Re: How to add new translations

Postby rogue-spectre » Sat Dec 20, 2014 10:12 pm

Ok, i'll try to see what i can do… eyes need to sleep. thanks
rogue-spectre
 
Posts: 6
Joined: Sat Dec 20, 2014 5:15 pm


Return to The FlightGear project

Who is online

Users browsing this forum: No registered users and 2 guests