Ver código fonte

HUE-1681 [core] set LOCALE_PATHS to remove deprecations

Abraham Elmahrek 12 anos atrás
pai
commit
662ae83e1c

+ 4 - 0
desktop/core/src/desktop/appmanager.py

@@ -185,6 +185,10 @@ class DesktopModuleInfo(object):
   def settings(self):
     return self._submodule("settings")
 
+  @property
+  def locale_path(self):
+    return os.path.join(os.path.dirname(self.module.__file__), 'locale')
+
   def _submodule(self, name):
     return _import_module_or_none(self.module.__name__ + "." + name)
 

+ 8 - 5
desktop/core/src/desktop/settings.py

@@ -157,6 +157,10 @@ INSTALLED_APPS = [
     'desktop'
 ]
 
+LOCALE_PATHS = [
+  'desktop'
+]
+
 # Keep default values up to date
 TEMPLATE_CONTEXT_PROCESSORS = (
   'django.contrib.auth.context_processors.auth',
@@ -169,11 +173,6 @@ TEMPLATE_CONTEXT_PROCESSORS = (
   'desktop.context_processors.app_name',
 )
 
-# Activate l10n
-LOCALE_PATHS = (
-  get_desktop_root('../apps/beeswax/src/beeswax/locale'),
-)
-
 
 # Desktop doesn't use an auth profile module, because
 # because it doesn't mesh very well with the notion
@@ -205,9 +204,13 @@ _config_dir = os.getenv("HUE_CONF_DIR", get_desktop_root("conf"))
 appmanager.load_libs()
 _lib_conf_modules = [dict(module=app.conf, config_key=None) for app in appmanager.DESKTOP_LIBS if app.conf is not None]
 
+# Activate l10n
+# Install apps
 appmanager.load_apps()
 for app in appmanager.DESKTOP_APPS:
   INSTALLED_APPS.extend(app.django_apps)
+  LOCALE_PATHS.append(app.locale_path)
+
 
 logging.debug("Installed Django modules: %s" % ",".join(map(str, appmanager.DESKTOP_MODULES)))