using translations in addons

using translations in addons

Postby jokro » Thu Aug 01, 2013 7:40 pm

Hi Volker,
I like to define and use translations for names and error messages inside an addon.
Could you please describe how to do so. Also how to use variables inside the message ?
Thx
Jodi
jokro
 
Posts: 486
Joined: Sun Jul 24, 2011 2:56 pm

Re: using translations in addons

Postby seb4stien » Sat Aug 03, 2013 10:21 am

Hi,

if you used the "Developper tools" add-on to create your add-on, it created a "translations" branch and an "en" node for your add-on.

To add new languages : add new nodes under "translations" (ex : fr, ge...).
To add new translations : add new attributes on each node :
- by default the "addons.${name}" attribute has been created to translate your add-on name
- menu are translated with their full path, ex : "main_menu_script/${name}"
- preferences are translated this way : OptionPanel.xxx
- and you can add any key for other translations. Personnaly I prefix them with addons.${name}.

To use these translations in your script : textUtils.getText("addons.collab.commandErrors").

The developper tools add-on is translated it self, so you can look at the sources :)

Sébastien
seb4stien
 
Posts: 32
Joined: Sat Jun 08, 2013 8:28 am

Re: using translations in addons

Postby jokro » Fri Aug 16, 2013 6:49 pm

seb4stien,.
thx. I did'nt react before because I wanted to test first. Unhapplily I (still) have a bug in he add-on installer, which is holding me from testing. I will come back when this is solved.
Regards
jodi
jokro
 
Posts: 486
Joined: Sun Jul 24, 2011 2:56 pm

Re: using translations in addons

Postby boercher » Mon Oct 21, 2013 10:27 pm

Hi Jokro, is the problem solved in the meanwhile? Could you extend the documentation if necessary?

Regards, Volker
boercher
 
Posts: 644
Joined: Tue Jul 26, 2011 7:13 am

Re: using translations in addons

Postby jokro » Thu Oct 31, 2013 4:27 pm

Yes this paricular problem is solved and I did update the wiki some time ago.
Regards
Jodi
jokro
 
Posts: 486
Joined: Sun Jul 24, 2011 2:56 pm


Return to Developers

Who is online

Users browsing this forum: No registered users and 1 guest

cron