equal
deleted
inserted
replaced
662 register_stored_procedures() |
662 register_stored_procedures() |
663 ConfigurationMixIn.__init__(self) |
663 ConfigurationMixIn.__init__(self) |
664 self.debugmode = debugmode |
664 self.debugmode = debugmode |
665 self.adjust_sys_path() |
665 self.adjust_sys_path() |
666 self.load_defaults() |
666 self.load_defaults() |
667 self.translations = {} |
667 # will be properly initialized later by _gettext_init |
|
668 self.translations = {'en': (unicode, lambda ctx, msgid: unicode(msgid) )} |
668 # don't register ReStructured Text directives by simple import, avoid pb |
669 # don't register ReStructured Text directives by simple import, avoid pb |
669 # with eg sphinx. |
670 # with eg sphinx. |
670 # XXX should be done properly with a function from cw.uicfg |
671 # XXX should be done properly with a function from cw.uicfg |
671 try: |
672 try: |
672 from cubicweb.ext.rest import cw_rest_init |
673 from cubicweb.ext.rest import cw_rest_init |
983 def load_configuration(self): |
984 def load_configuration(self): |
984 """load instance's configuration files""" |
985 """load instance's configuration files""" |
985 super(CubicWebConfiguration, self).load_configuration() |
986 super(CubicWebConfiguration, self).load_configuration() |
986 if self.apphome and self.set_language: |
987 if self.apphome and self.set_language: |
987 # init gettext |
988 # init gettext |
988 self._set_language() |
989 self._gettext_init() |
989 |
990 |
990 def init_log(self, logthreshold=None, force=False): |
991 def init_log(self, logthreshold=None, force=False): |
991 """init the log service""" |
992 """init the log service""" |
992 if not force and hasattr(self, '_logging_initialized'): |
993 if not force and hasattr(self, '_logging_initialized'): |
993 return |
994 return |
1011 '*', 'LC_MESSAGES')): |
1012 '*', 'LC_MESSAGES')): |
1012 lang = path.split(os.sep)[-2] |
1013 lang = path.split(os.sep)[-2] |
1013 if lang != 'en': |
1014 if lang != 'en': |
1014 yield lang |
1015 yield lang |
1015 |
1016 |
1016 def _set_language(self): |
1017 def _gettext_init(self): |
1017 """set language for gettext""" |
1018 """set language for gettext""" |
1018 from gettext import translation |
1019 from gettext import translation |
1019 path = join(self.apphome, 'i18n') |
1020 path = join(self.apphome, 'i18n') |
1020 for language in self.available_languages(): |
1021 for language in self.available_languages(): |
1021 self.info("loading language %s", language) |
1022 self.info("loading language %s", language) |