Example #1
0
 def gettext_translations(self):
   locale = str(self.locale)
   try:
     path = self.pod.abs_path(os.path.join('translations', locale))
     dir_path = os.path.dirname(path)
     translations = gettext.translation('messages', dir_path, [locale],
                                        storage=self.pod.storage)
   except IOError:
     # TODO(jeremydw): If translation mode is strict, raise an error here if
     # no translation file is found.
     translations = gettext.NullTranslations()
   return translations
Example #2
0
 def gettext_translations(self):
     locale = str(self.locale)
     try:
         path = os.path.join(self.pod.root, 'translations', locale)
         translations = gettext.translation('messages',
                                            os.path.dirname(path), [locale],
                                            storage=self.pod.storage)
     except IOError:
         # TODO(jeremydw): If translation mode is strict, raise an error here if
         # no translation file is found.
         translations = gettext.NullTranslations()
     return translations
Example #3
0
  def __init__(self, pod, locale):
    self.pod = pod
    self.locale = locale
    self.path = os.path.join('/translations', locale)

    try:
      translations = gettext.translation(
          'messages', os.path.dirname(self.path), languages=[self.locale],
          storage=self.pod.storage)
    except IOError:
      translations = gettext.NullTranslations()
    self._gettext_translations = translations
Example #4
0
 def __init__(self, pod, locale):
   self.pod = pod
   locale_code = str(locale)
   self.locale = locale
   self.path = os.path.join('translations', locale_code)
   try:
     path = os.path.join(self.pod.root, 'translations', locale_code)
     translations = gettext.translation(
         'messages', os.path.dirname(path), [locale_code],
         storage=self.pod.storage)
   except IOError:
     # TODO(jeremydw): If translation mode is strict, raise an error here if
     # no translation file is found.
     translations = gettext.NullTranslations()
   self._gettext_translations = translations