Watch for i18n files changes for auto-reload
authorDenis Laxalde <denis.laxalde@logilab.fr>
Fri, 19 Sep 2014 18:23:57 +0200
changeset 11639 f38ec5e29de3
parent 11638 12de153c0d0e
child 11640 e45e4999dc98
Watch for i18n files changes for auto-reload
ccplugin.py
--- a/ccplugin.py	Fri Sep 19 11:44:13 2014 +0200
+++ b/ccplugin.py	Fri Sep 19 18:23:57 2014 +0200
@@ -225,6 +225,15 @@
         mon_thread.daemon = True
         mon_thread.start()
 
+    def i18nfiles(self, cwconfig):
+        """Return instance i18n files"""
+        i18ndir = os.path.join(cwconfig.apphome, 'i18n')
+        if os.path.exists(i18ndir):
+            for lang in cwconfig.available_languages():
+                f = os.path.join(i18ndir, lang, 'LC_MESSAGES', 'cubicweb.mo')
+                if os.path.exists(f):
+                    yield f
+
     def pyramid_instance(self, appid):
         self._needreload = False
 
@@ -237,6 +246,7 @@
             _turn_sigterm_into_systemexit()
             self.debug('Running reloading file monitor')
             extra_files = [sys.argv[0], cwconfig.main_config_file()]
+            extra_files.extend(self.i18nfiles(cwconfig))
             self.install_reloader(
                 self['reload-interval'], extra_files,
                 filelist_path=os.environ.get(