Author: remi
Date: 2009-10-15 12:11:58 +0200 (Thu, 15 Oct 2009)
New Revision: 5674
Modified:
software_suite_v3/smart-core/smart-server/trunk/translation/Translation.py
Log:
* Added a method to dynamically add po directories to the translation object
Modified:
software_suite_v3/smart-core/smart-server/trunk/translation/Translation.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/translation/Translation.py
2009-10-15 09:49:15 UTC (rev 5673)
+++ software_suite_v3/smart-core/smart-server/trunk/translation/Translation.py
2009-10-15 10:11:58 UTC (rev 5674)
@@ -37,6 +37,27 @@
else:
self.__i18nList[language] = i18n
+ def addPoDirectory(self, directory):
+ """
+ """
+ if not os.path.isdir(directory):
+ return
+ for language in SUPPORTED_LANGUAGES_LIST:
+ if not self.__i18nList.has_key(language):
+ i18n = I18n()
+ i18n.setPoDirectory(directory)
+ i18n.setLocale(language)
+ i18n.update()
+ if i18n.getDictionnary() == {}:
+ self.__i18nList[language] = self.__i18nList["en"]
+ else:
+ self.__i18nList[language] = i18n
+ else:
+ i18n = self.__i18nList[language]
+ i18n.setPoDirectory(directory)
+ i18n.setLocale(language)
+ i18n.update()
+
def getTranslations(self, language):
"""
"""
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn