Hi,

have a look how I do the translation in my add-ons:

- Define a string dict:
https://github.com/dersphere/plugin.video.hdtrailers_net/blob/master/addon.py#L23(This
can also be a seperate file)
- Create a small helper function:
https://github.com/dersphere/plugin.video.hdtrailers_net/blob/master/addon.py#L291
- Now you can write easy to read code:
https://github.com/dersphere/plugin.video.hdtrailers_net/blob/master/addon.py#L247

regards,
sphere


2014-04-07 19:41 GMT+02:00 Paul Backhouse <paul_backho...@hotmail.com>:

>  On 07/04/14 17:48, Martijn Kaijser wrote:
>
> That makes no difference at all as this will not work for the Settings.xml
> so you will still need to use the strings.po for starters.
>
> Ah OK I didn't realise you wanted xml strings translated too. But it makes
> sense.
>
>
>  Also I see no advantages using the Python tools with taking into account
> you still need to get the set xbmc gui language which the build in method
> auto handles.
>
>
> I can pull the language out with xbmc.getLanguage(), so I don't think
> that's an issue.
>
> The advantage is that you have code that looks like this:
>
>     Dialog.ok(_('Press OK to format your hard drive'))
>
> and not this:
>
>     Dialog.ok(xbmc.getLocalizedString(54353))
>
> I know which I prefer.
>
> In the second case, anyone reading over the code will have no idea what
> the user is agreeing to. To find out they have to either a) rummage through
> .po files. b) run the code to find out. Putting a comment above the line
> itself is a mediocre solution, the code should be self-explanatory.
>
>
> Paul
>
>   On 7 Apr 2014 18:41, "Paul Backhouse" <paul_backho...@hotmail.com>
> wrote:
>
>> On 07/04/14 13:45, Martijn Kaijser wrote:
>> > >which tools?
>>
>> https://docs.python.org/2/library/gettext.html
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Put Bad Developers to Shame
>> Dominate Development with Jenkins Continuous Integration
>> Continuously Automate Build, Test & Deployment
>> Start a new project now. Try Jenkins in the cloud.
>> http://p.sf.net/sfu/13600_Cloudbees_APR
>> _______________________________________________
>> Xbmc-addons mailing list
>> Xbmc-addons@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/xbmc-addons
>>
>
>
>
> ------------------------------------------------------------------------------
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment
> Start a new project now. Try Jenkins in the cloud.
> http://p.sf.net/sfu/13600_Cloudbees
> _______________________________________________
> Xbmc-addons mailing list
> Xbmc-addons@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/xbmc-addons
>
>
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Xbmc-addons mailing list
Xbmc-addons@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to