Browse Source

Skip plugin translations for python3.

Until babel releases a new version with a fix for merging message
catalogs in python3. https://github.com/mitsuhiko/babel/pull/92
sh4nks 10 years ago
parent
commit
d434e89da6
1 changed files with 11 additions and 0 deletions
  1. 11 0
      flaskbb/utils/translations.py

+ 11 - 0
flaskbb/utils/translations.py

@@ -5,6 +5,8 @@ import babel
 from flask_babelex import Domain, get_locale
 from flask_babelex import Domain, get_locale
 from flask_plugins import get_plugins_list
 from flask_plugins import get_plugins_list
 
 
+from flaskbb._compat import PY2
+
 
 
 class FlaskBBDomain(Domain):
 class FlaskBBDomain(Domain):
     def __init__(self, app):
     def __init__(self, app):
@@ -50,6 +52,15 @@ class FlaskBBDomain(Domain):
             if not isinstance(translations, babel.support.Translations):
             if not isinstance(translations, babel.support.Translations):
                 return translations
                 return translations
 
 
+            # Plugin translations are at the moment not supported under
+            # Python 3. There is currently a bug in Babel where it is
+            # not possible to merge two message catalogs.
+            # https://github.com/mitsuhiko/babel/pull/92
+            # So instead of adding/merging them, we are just skipping them
+            # Better then no python3 support though..
+            if not PY2:
+                return translations
+
             # now load and add the plugin translations
             # now load and add the plugin translations
             for plugin in self.plugin_translations:
             for plugin in self.plugin_translations:
                 plugin_translation = babel.support.Translations.load(
                 plugin_translation = babel.support.Translations.load(