Exemplo n.º 1
0
    def discoverLocaleSet(self):
        """
         Queries the Operating System for the current locale sets.
         The Operating System may return one or more locales.

         In the case where more than one locale is returned
         the translation fallback will try each locale in the set
         in order till a resource or translation is encountered.

         Note: For Preview only the primary locale will be used.

         The discoverLocaleSet method can raise the following
         exceptions:
            1. c{I18nException}

         @return: c{str} The Operating System primary locale

        """
        assert self._init

        locale = None

        if wxIsAvailable():
            # Try to get the Locale from WxPython
            locale = I18nLocale(wx.LANGUAGE_DEFAULT, i18nMan=self).GetName()

        if locale is None or len(locale.strip()) == 0:
            # Try to ge the Locale from PyICU
            locale = Locale.getDefault().getName()

        if locale is None or len(locale.strip()) == 0:
            # Try to get the Locale from a System environmental
            # variable
            locale = os.getenv("LANG")

        if locale is None or len(locale.strip()) == 0:
            # Try to get the Locale from a System environmental
            # variable
            locale = os.getenv("LANGUAGE")

        return locale
Exemplo n.º 2
0
    def discoverLocaleSet(self):
        """
         Queries the Operating System for the current locale sets.
         The Operating System may return one or more locales.

         In the case where more than one locale is returned
         the translation fallback will try each locale in the set
         in order till a resource or translation is encountered.

         Note: For Preview only the primary locale will be used.

         The discoverLocaleSet method can raise the following
         exceptions:
            1. c{I18nException}

         @return: c{str} The Operating System primary locale

        """
        assert self._init

        locale = None

        if wxIsAvailable():
            # Try to get the Locale from WxPython
            locale = I18nLocale(wx.LANGUAGE_DEFAULT, i18nMan=self).GetName()

        if locale is None or len(locale.strip()) == 0:
            # Try to ge the Locale from PyICU
            locale = Locale.getDefault().getName()

        if locale is None or len(locale.strip()) == 0:
            # Try to get the Locale from a System environmental
            # variable
            locale = os.getenv("LANG")

        if locale is None or len(locale.strip()) == 0:
            # Try to get the Locale from a System environmental
            # variable
            locale = os.getenv("LANGUAGE")

        return locale
    def setUp(self):
        super(AbstractTimeZoneTestCase, self).setUp()

        self.oldLocale = ICULocale.getDefault()
        self.oldTzinfo = self.view.tzinfo.default
Exemplo n.º 4
0
    def setUp(self):
        super(AbstractTimeZoneTestCase, self).setUp()

        self.oldLocale = ICULocale.getDefault()
        self.oldTzinfo = self.view.tzinfo.default