changeset 67:24ec4c3430cf

better fallback for i18n strings not found: use formatted en translation imported from: moin--main--1.5--patch-69
author Thomas Waldmann <tw@waldmann-edv.de>
date Sun, 02 Oct 2005 06:39:02 +0000
parents 20993d3996e9
children 0bbc39b09f95
files MoinMoin/i18n/__init__.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/i18n/__init__.py	Sat Oct 01 07:58:16 2005 +0000
+++ b/MoinMoin/i18n/__init__.py	Sun Oct 02 06:39:02 2005 +0000
@@ -283,7 +283,7 @@
     return ('ltr', 'rtl')[languages[lang][DIRECTION]]
 
 
-def getText(str, request, lang, formatted = True):
+def getText(str, request, lang, formatted=True):
     """
     Return a translation of text in the user's language.
     """
@@ -315,7 +315,10 @@
                     userdict = dicts.dict(dictpagename)
                     trans = userdict[str]
         except KeyError:
-            pass
+            # do not simply return trans with str, but recursively call
+            # to get english translation, maybe formatted
+            if lang != 'en':
+                trans = getText(str, request, 'en', formatted)
     return trans