Change to translation.py

13 views
Skip to first unread message

Jim Eggleston

unread,
Jul 17, 2014, 1:31:34 AM7/17/14
to karr...@googlegroups.com
Hi Pierre,

Finding a free site that supports Python 3 has inspired me to play with Karrigell again after a long hiatus. 

In the current version of translation.py it is necessary to specify a default for each translation. Since this is generally the same as the primary language it becomes necessary to duplicate the entries in the ini file. e.g.:

[password]
fr=Mot de passe
en=Password
default=Password

This becomes a little tedious if there are many translations to manage.

I changed translation.py so that the default language can be specified in a special [__default__] section of the ini file. e.g.:

[__default__]
default_language=en

The script then uses the translations for the default language if it cannot find a translation for the language specified by the browser. The individual default settings can be removed.

If no default language is specified in the ini file then the script will use "en". If no translation is found at all then the script returns the source string as before.

I have attached the script and a sample ini file.  Let me know what you think. If you are happy with it I will do some more testing, commit the changes and update the documentation.

Cheers,
Jim
translations.ini
translation.py

Pierre QUENTEL

unread,
Aug 1, 2014, 3:58:33 AM8/1/14
to karr...@googlegroups.com

Hi Jim,

That's ok for me, you can go ahead and commit the changes

Thanks
Pierre

> Message du 17/07/14 07:31
> De : "Jim Eggleston" <jim.eg...@gmail.com>
> A : karr...@googlegroups.com
> Copie à :
> Objet : [karrigell] Change to translation.py
--
You received this message because you are subscribed to the Google Groups "karrigell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to karrigell+...@googlegroups.com.
To post to this group, send email to karr...@googlegroups.com.
Visit this group at http://groups.google.com/group/karrigell.
For more options, visit https://groups.google.com/d/optout.

>
> [ translations.ini (1.5 Ko) ]
> [ translation.py (0.9 Ko) ]
translation.py

Jim Eggleston

unread,
Sep 14, 2014, 3:07:57 AM9/14/14
to karrigell
Hi Pierre,

Thanks for committing the changes. I have updated the documentation on the wiki. Apologies for the delay, the last month has been somewhat hectic ...


Cheers,
Jim

Reply all
Reply to author
Forward
0 new messages