Example #1
0
    def setUp(self):
        # force use of local locale directory. System locale dir
        # doesn't have the locale files installed, and without wiping
        # the default the .mo file sometimes isn't found.
        self.backup_domain = i18n.DOMAIN
        i18n.DOMAIN = ''
        self.backup_locale_dirs = i18n.LOCALE_DIRS
        i18n.LOCALE_DIRS = ["locale"]

        self.old_gettext_ = i18n.gettext
        self.old_ngettext_ = i18n.ngettext
        i18n.gettext = i18n.get_translation(language='C').gettext
        i18n.degettext = i18n.get_translation(language='de').gettext
        i18n.ngettext = i18n.get_translation(language='C').ngettext
        i18n.dengettext = i18n.get_translation(language='de').ngettext
def get_translation(language=None,
                    tracker_home=None,
                    translation_class=TranslationService,
                    null_translation_class=NullTranslationService):
    """Return Translation object for given language and domain

    Arguments 'translation_class' and 'null_translation_class'
    specify the classes that are instantiated for existing
    and non-existing translations, respectively.
    """
    return i18n.get_translation(language=language,
                                tracker_home=tracker_home,
                                translation_class=translation_class,
                                null_translation_class=null_translation_class)
Example #3
0
def get_translation(language=None, tracker_home=None,
    translation_class=TranslationService,
    null_translation_class=NullTranslationService
):
    """Return Translation object for given language and domain

    Arguments 'translation_class' and 'null_translation_class'
    specify the classes that are instantiated for existing
    and non-existing translations, respectively.
    """
    return i18n.get_translation(language=language,
        tracker_home=tracker_home,
        translation_class=translation_class,
        null_translation_class=null_translation_class)
Example #4
0
 def setUp(self):
     self.old_gettext_ = i18n.gettext
     self.old_ngettext_ = i18n.ngettext
     i18n.gettext = i18n.get_translation(language='C').gettext
     i18n.ngettext = i18n.get_translation(language='C').ngettext
Example #5
0
 def setUp(self):
     self.old_gettext_ = i18n.gettext
     self.old_ngettext_ = i18n.ngettext
     i18n.gettext = i18n.get_translation(language='C').gettext
     i18n.ngettext = i18n.get_translation(language='C').ngettext