[Mpuls-commits] r2944 - base/trunk/mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jun 9 14:26:20 CEST 2010


Author: torsten
Date: 2010-06-09 14:26:20 +0200 (Wed, 09 Jun 2010)
New Revision: 2944

Modified:
   base/trunk/mpulsweb/lib/translation.py
Log:
* mpulsweb/lib/translation.py (ugettext): New function to translate a string



Modified: base/trunk/mpulsweb/lib/translation.py
===================================================================
--- base/trunk/mpulsweb/lib/translation.py	2010-06-09 12:21:46 UTC (rev 2943)
+++ base/trunk/mpulsweb/lib/translation.py	2010-06-09 12:26:20 UTC (rev 2944)
@@ -1,4 +1,5 @@
 import os
+import logging
 from gettext import NullTranslations, translation
 
 import pylons
@@ -6,6 +7,24 @@
 # Copied from pylons.i18n.translation. Adapted code to allow otional locations
 # of language files
 
+log = logging.getLogger(__name__)
+
+def ugettext(value):
+    """Mark a string for translation. Returns the localized unicode
+    string of value.
+
+    Mark a string to be localized as follows::
+
+        _('This should be in lots of languages')
+    
+    """
+    translated = pylons.translator.ugettext(value)
+    log.debug("String: %s" % translated)
+    return translated
+
+_ = ugettext
+
+
 def _get_translator(lang, **kwargs):
     """Utility method to get a valid translator object from a language
     name"""



More information about the Mpuls-commits mailing list