예제 #1
0
    def testLocales(self):
        zh_hk = QLocale(QLocale.Chinese, QLocale.HongKong)
        en_us = QLocale(QLocale.English, QLocale.UnitedStates)

        self.assertEquals(QLocale.Chinese, zh_hk.language())
        self.assertEquals(QLocale.HongKong, zh_hk.country())

        self.assertEquals(QLocale.English, en_us.language())
        self.assertEquals(QLocale.UnitedStates, en_us.country())

        appLangs = {}
        appLangs[zh_hk] = "zh_hk"
        self.assertEquals(appLangs[zh_hk], "zh_hk")
예제 #2
0
파일: i18n.py 프로젝트: khosrow/luma-devel
    def __buildLanguageDictionary(self):
        """Builds the language dictionary used by the application. The
        dictionary is constructed with the locale code as key, and a
        list containing the language name (and possibly the country
        name) as value. The information is based on the ``i18n``entries
        in the ``resources.py`` module, where the alias for a one
        translation file is locale code for the translation.

        If the translation file is named ``luma_nn_NO.ts`` the
        corresponding alias for this file will be ``nb_NO``. Further
        more ``nb`` will map to ``QLocale.NorwegianBokmal``and ``NO``
        will map to ``QLocale.Norway``, resulting in the following entry
        in the dictionary::

            langDict = {
                ...,
                'en' : ['English'], # Default is allways included
                'nb_NO' : ['Norwegian', 'Norway'],
                ...
            }
        """
        for i18n in self.__translationPath:
            if i18n == 'hx':
                self.__availableLanguages[i18n] = ['leet', '10100111001']
            else:
                locale = QLocale(i18n)
                language = QLocale.languageToString(locale.language())
                country = QLocale.countryToString(locale.country())
                self.__availableLanguages[i18n] = [language, country]
예제 #3
0
파일: i18n.py 프로젝트: vegarwe/luma
    def __buildLanguageDictionary(self):
        """Builds the language dictionary used by the application. The
        dictionary is constructed with the locale code as key, and a
        list containing the language name (and possibly the country
        name) as value. The information is based on the ``i18n``entries
        in the ``resources.py`` module, where the alias for a one
        translation file is locale code for the translation.

        If the translation file is named ``luma_nn_NO.ts`` the
        corresponding alias for this file will be ``nb_NO``. Further
        more ``nb`` will map to ``QLocale.NorwegianBokmal``and ``NO``
        will map to ``QLocale.Norway``, resulting in the following entry
        in the dictionary::

            langDict = {
                ...,
                'en' : ['English'], # Default is allways included
                'nb_NO' : ['Norwegian', 'Norway'],
                ...
            }
        """
        for i18n in self.__translationPath:
            if i18n == "hx":
                self.__availableLanguages[i18n] = ["leet", "10100111001"]
            else:
                locale = QLocale(i18n)
                language = QLocale.languageToString(locale.language())
                country = QLocale.countryToString(locale.country())
                self.__availableLanguages[i18n] = [language, country]
예제 #4
0
파일: fluxbox.py 프로젝트: ademirel/COMAK
 def getLanguage(self):
     locale_app = QLocale()
     locale_os = QLocale.system()
     info = []
     var = QLocale.languageToString(locale_app.language())
     return var
예제 #5
0
 def getLanguage(self):
     locale_app = QLocale()
     locale_os = QLocale.system()
     info = []
     var = QLocale.languageToString(locale_app.language())
     return var