Revert some changes to how languages are loaded and remove iso.py
This commit is contained in:
+17
-18
@@ -78,9 +78,6 @@ class Config:
|
|||||||
self.iconPath = None # The full path to the nw/assets/icons folder
|
self.iconPath = None # The full path to the nw/assets/icons folder
|
||||||
self.helpPath = None # The full path to the novelwriter .qhc help file
|
self.helpPath = None # The full path to the novelwriter .qhc help file
|
||||||
|
|
||||||
# Internationalisation
|
|
||||||
self.qtTrans = {}
|
|
||||||
|
|
||||||
# Runtime Settings and Variables
|
# Runtime Settings and Variables
|
||||||
self.confChanged = False # True whenever the config has chenged, false after save
|
self.confChanged = False # True whenever the config has chenged, false after save
|
||||||
self.hasHelp = False # True if the Qt help files are present in the assets folder
|
self.hasHelp = False # True if the Qt help files are present in the assets folder
|
||||||
@@ -97,12 +94,10 @@ class Config:
|
|||||||
|
|
||||||
## Localisation
|
## Localisation
|
||||||
self.qLocal = QLocale.system()
|
self.qLocal = QLocale.system()
|
||||||
self.guiLang = self.qLocal.name()
|
self.guiLang = self.qLocal.bcp47Name()
|
||||||
self.qtLangPath = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
|
self.qtLangPath = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
|
||||||
self.nwLangPath = None
|
self.nwLangPath = None
|
||||||
self.i18nQtMain = QTranslator()
|
self.qtTrans = {}
|
||||||
self.i18nQtBase = QTranslator()
|
|
||||||
self.i18nNWBase = QTranslator()
|
|
||||||
|
|
||||||
## Sizes
|
## Sizes
|
||||||
self.winGeometry = [1200, 650]
|
self.winGeometry = [1200, 650]
|
||||||
@@ -376,18 +371,22 @@ class Config:
|
|||||||
"""
|
"""
|
||||||
self.qLocal = QLocale(self.guiLang)
|
self.qLocal = QLocale(self.guiLang)
|
||||||
QLocale.setDefault(self.qLocal)
|
QLocale.setDefault(self.qLocal)
|
||||||
|
self.qtTrans = {}
|
||||||
|
|
||||||
if self.i18nQtMain.load(self.qLocal, "qt", "_", self.qtLangPath):
|
langList = [
|
||||||
nwApp.installTranslator(self.i18nQtMain)
|
(self.qtLangPath, "qt"),
|
||||||
logger.debug("Loaded: %s" % self.i18nQtMain.filePath())
|
(self.qtLangPath, "qtbase"),
|
||||||
|
(self.nwLangPath, "nw"),
|
||||||
if self.i18nQtBase.load(self.qLocal, "qtbase", "_", self.qtLangPath):
|
]
|
||||||
nwApp.installTranslator(self.i18nQtBase)
|
for lngPath, lngBase in langList:
|
||||||
logger.debug("Loaded: %s" % self.i18nQtBase.filePath())
|
for lngCode in self.qLocal.uiLanguages():
|
||||||
|
qTrans = QTranslator()
|
||||||
if self.i18nNWBase.load(self.qLocal, "nw", "_", self.nwLangPath):
|
lngFile = "%s_%s" % (lngBase, lngCode)
|
||||||
nwApp.installTranslator(self.i18nNWBase)
|
if lngFile not in self.qtTrans:
|
||||||
logger.debug("Loaded: %s" % self.i18nNWBase.filePath())
|
if qTrans.load(lngFile, lngPath):
|
||||||
|
logger.debug("Loaded: %s" % qTrans.filePath())
|
||||||
|
nwApp.installTranslator(qTrans)
|
||||||
|
self.qtTrans[lngFile] = qTrans
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from nw.constants.iso import isoLanguage, isoCountry
|
|
||||||
from nw.constants.constants import (
|
from nw.constants.constants import (
|
||||||
nwConst, nwLists, nwRegEx, nwFiles, nwKeyWords, nwLabels, nwQuotes,
|
nwConst, nwLists, nwRegEx, nwFiles, nwKeyWords, nwLabels, nwQuotes,
|
||||||
nwUnicode, nwHtmlUnicode
|
nwUnicode, nwHtmlUnicode
|
||||||
@@ -10,8 +9,6 @@ from nw.constants.enum import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"isoCountry",
|
|
||||||
"isoLanguage",
|
|
||||||
"nwConst",
|
"nwConst",
|
||||||
"nwLists",
|
"nwLists",
|
||||||
"nwRegEx",
|
"nwRegEx",
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from PyQt5.QtCore import QT_TRANSLATE_NOOP
|
from PyQt5.QtCore import QT_TRANSLATE_NOOP
|
||||||
|
|
||||||
from nw.constants.enum import (
|
from nw.constants.enum import (
|
||||||
nwItemClass, nwItemLayout, nwItemType, nwOutline
|
nwItemClass, nwItemLayout, nwItemType, nwOutline
|
||||||
)
|
)
|
||||||
@@ -42,8 +43,8 @@ class nwConst():
|
|||||||
MAX_BUILDSIZE = 10000000 # Maxium size of a project build
|
MAX_BUILDSIZE = 10000000 # Maxium size of a project build
|
||||||
|
|
||||||
# Spell Check Providers
|
# Spell Check Providers
|
||||||
SP_INTERNAL = QT_TRANSLATE_NOOP("Constant", "internal")
|
SP_INTERNAL = "internal"
|
||||||
SP_ENCHANT = QT_TRANSLATE_NOOP("Constant", "enchant")
|
SP_ENCHANT = "enchant"
|
||||||
|
|
||||||
# END Class nwConst
|
# END Class nwConst
|
||||||
|
|
||||||
|
|||||||
@@ -1,475 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
|
||||||
novelWriter – ISO Codes
|
|
||||||
=======================
|
|
||||||
Handles translating language codes to language names
|
|
||||||
|
|
||||||
File History:
|
|
||||||
Created: 2019-11-05 [0.4.0]
|
|
||||||
|
|
||||||
This file is a part of novelWriter
|
|
||||||
Copyright 2018–2021, Veronica Berglyd Olsen
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from PyQt5.QtCore import QT_TRANSLATE_NOOP
|
|
||||||
|
|
||||||
|
|
||||||
class isoLanguage():
|
|
||||||
|
|
||||||
ISO_639_1 = {
|
|
||||||
"aa" : QT_TRANSLATE_NOOP("ISO", "Afar"),
|
|
||||||
"ab" : QT_TRANSLATE_NOOP("ISO", "Abkhazian"),
|
|
||||||
"ae" : QT_TRANSLATE_NOOP("ISO", "Avestan"),
|
|
||||||
"af" : QT_TRANSLATE_NOOP("ISO", "Afrikaans"),
|
|
||||||
"ak" : QT_TRANSLATE_NOOP("ISO", "Akan"),
|
|
||||||
"am" : QT_TRANSLATE_NOOP("ISO", "Amharic"),
|
|
||||||
"an" : QT_TRANSLATE_NOOP("ISO", "Aragonese"),
|
|
||||||
"ar" : QT_TRANSLATE_NOOP("ISO", "Arabic"),
|
|
||||||
"as" : QT_TRANSLATE_NOOP("ISO", "Assamese"),
|
|
||||||
"av" : QT_TRANSLATE_NOOP("ISO", "Avaric"),
|
|
||||||
"ay" : QT_TRANSLATE_NOOP("ISO", "Aymara"),
|
|
||||||
"az" : QT_TRANSLATE_NOOP("ISO", "Azerbaijani"),
|
|
||||||
"ba" : QT_TRANSLATE_NOOP("ISO", "Bashkir"),
|
|
||||||
"be" : QT_TRANSLATE_NOOP("ISO", "Belarusian"),
|
|
||||||
"bg" : QT_TRANSLATE_NOOP("ISO", "Bulgarian"),
|
|
||||||
"bh" : QT_TRANSLATE_NOOP("ISO", "Bihari languages"),
|
|
||||||
"bi" : QT_TRANSLATE_NOOP("ISO", "Bislama"),
|
|
||||||
"bm" : QT_TRANSLATE_NOOP("ISO", "Bambara"),
|
|
||||||
"bn" : QT_TRANSLATE_NOOP("ISO", "Bengali"),
|
|
||||||
"bo" : QT_TRANSLATE_NOOP("ISO", "Tibetan"),
|
|
||||||
"br" : QT_TRANSLATE_NOOP("ISO", "Breton"),
|
|
||||||
"bs" : QT_TRANSLATE_NOOP("ISO", "Bosnian"),
|
|
||||||
"ca" : QT_TRANSLATE_NOOP("ISO", "Catalan"),
|
|
||||||
"ce" : QT_TRANSLATE_NOOP("ISO", "Chechen"),
|
|
||||||
"ch" : QT_TRANSLATE_NOOP("ISO", "Chamorro"),
|
|
||||||
"co" : QT_TRANSLATE_NOOP("ISO", "Corsican"),
|
|
||||||
"cr" : QT_TRANSLATE_NOOP("ISO", "Cree"),
|
|
||||||
"cs" : QT_TRANSLATE_NOOP("ISO", "Czech"),
|
|
||||||
"cu" : QT_TRANSLATE_NOOP("ISO", "Church Slavic"),
|
|
||||||
"cv" : QT_TRANSLATE_NOOP("ISO", "Chuvash"),
|
|
||||||
"cy" : QT_TRANSLATE_NOOP("ISO", "Welsh"),
|
|
||||||
"da" : QT_TRANSLATE_NOOP("ISO", "Danish"),
|
|
||||||
"de" : QT_TRANSLATE_NOOP("ISO", "German"),
|
|
||||||
"dv" : QT_TRANSLATE_NOOP("ISO", "Divehi"),
|
|
||||||
"dz" : QT_TRANSLATE_NOOP("ISO", "Dzongkha"),
|
|
||||||
"ee" : QT_TRANSLATE_NOOP("ISO", "Ewe"),
|
|
||||||
"el" : QT_TRANSLATE_NOOP("ISO", "Modern Greek"),
|
|
||||||
"en" : QT_TRANSLATE_NOOP("ISO", "English"),
|
|
||||||
"eo" : QT_TRANSLATE_NOOP("ISO", "Esperanto"),
|
|
||||||
"es" : QT_TRANSLATE_NOOP("ISO", "Spanish"),
|
|
||||||
"et" : QT_TRANSLATE_NOOP("ISO", "Estonian"),
|
|
||||||
"eu" : QT_TRANSLATE_NOOP("ISO", "Basque"),
|
|
||||||
"fa" : QT_TRANSLATE_NOOP("ISO", "Persian"),
|
|
||||||
"ff" : QT_TRANSLATE_NOOP("ISO", "Fulah"),
|
|
||||||
"fi" : QT_TRANSLATE_NOOP("ISO", "Finnish"),
|
|
||||||
"fj" : QT_TRANSLATE_NOOP("ISO", "Fijian"),
|
|
||||||
"fo" : QT_TRANSLATE_NOOP("ISO", "Faroese"),
|
|
||||||
"fr" : QT_TRANSLATE_NOOP("ISO", "French"),
|
|
||||||
"fy" : QT_TRANSLATE_NOOP("ISO", "Western Frisian"),
|
|
||||||
"ga" : QT_TRANSLATE_NOOP("ISO", "Irish"),
|
|
||||||
"gd" : QT_TRANSLATE_NOOP("ISO", "Gaelic"),
|
|
||||||
"gl" : QT_TRANSLATE_NOOP("ISO", "Galician"),
|
|
||||||
"gn" : QT_TRANSLATE_NOOP("ISO", "Guarani"),
|
|
||||||
"gu" : QT_TRANSLATE_NOOP("ISO", "Gujarati"),
|
|
||||||
"gv" : QT_TRANSLATE_NOOP("ISO", "Manx"),
|
|
||||||
"ha" : QT_TRANSLATE_NOOP("ISO", "Hausa"),
|
|
||||||
"he" : QT_TRANSLATE_NOOP("ISO", "Hebrew"),
|
|
||||||
"hi" : QT_TRANSLATE_NOOP("ISO", "Hindi"),
|
|
||||||
"ho" : QT_TRANSLATE_NOOP("ISO", "Hiri Motu"),
|
|
||||||
"hr" : QT_TRANSLATE_NOOP("ISO", "Croatian"),
|
|
||||||
"ht" : QT_TRANSLATE_NOOP("ISO", "Haitian"),
|
|
||||||
"hu" : QT_TRANSLATE_NOOP("ISO", "Hungarian"),
|
|
||||||
"hy" : QT_TRANSLATE_NOOP("ISO", "Armenian"),
|
|
||||||
"hz" : QT_TRANSLATE_NOOP("ISO", "Herero"),
|
|
||||||
"ia" : QT_TRANSLATE_NOOP("ISO", "Interlingua"),
|
|
||||||
"id" : QT_TRANSLATE_NOOP("ISO", "Indonesian"),
|
|
||||||
"ie" : QT_TRANSLATE_NOOP("ISO", "Interlingue"),
|
|
||||||
"ig" : QT_TRANSLATE_NOOP("ISO", "Igbo"),
|
|
||||||
"ii" : QT_TRANSLATE_NOOP("ISO", "Sichuan Yi"),
|
|
||||||
"ik" : QT_TRANSLATE_NOOP("ISO", "Inupiaq"),
|
|
||||||
"io" : QT_TRANSLATE_NOOP("ISO", "Ido"),
|
|
||||||
"is" : QT_TRANSLATE_NOOP("ISO", "Icelandic"),
|
|
||||||
"it" : QT_TRANSLATE_NOOP("ISO", "Italian"),
|
|
||||||
"iu" : QT_TRANSLATE_NOOP("ISO", "Inuktitut"),
|
|
||||||
"ja" : QT_TRANSLATE_NOOP("ISO", "Japanese"),
|
|
||||||
"jv" : QT_TRANSLATE_NOOP("ISO", "Javanese"),
|
|
||||||
"ka" : QT_TRANSLATE_NOOP("ISO", "Georgian"),
|
|
||||||
"kg" : QT_TRANSLATE_NOOP("ISO", "Kongo"),
|
|
||||||
"ki" : QT_TRANSLATE_NOOP("ISO", "Kikuyu"),
|
|
||||||
"kj" : QT_TRANSLATE_NOOP("ISO", "Kuanyama"),
|
|
||||||
"kk" : QT_TRANSLATE_NOOP("ISO", "Kazakh"),
|
|
||||||
"kl" : QT_TRANSLATE_NOOP("ISO", "Kalaallisut"),
|
|
||||||
"km" : QT_TRANSLATE_NOOP("ISO", "Central Khmer"),
|
|
||||||
"kn" : QT_TRANSLATE_NOOP("ISO", "Kannada"),
|
|
||||||
"ko" : QT_TRANSLATE_NOOP("ISO", "Korean"),
|
|
||||||
"kr" : QT_TRANSLATE_NOOP("ISO", "Kanuri"),
|
|
||||||
"ks" : QT_TRANSLATE_NOOP("ISO", "Kashmiri"),
|
|
||||||
"ku" : QT_TRANSLATE_NOOP("ISO", "Kurdish"),
|
|
||||||
"kv" : QT_TRANSLATE_NOOP("ISO", "Komi"),
|
|
||||||
"kw" : QT_TRANSLATE_NOOP("ISO", "Cornish"),
|
|
||||||
"ky" : QT_TRANSLATE_NOOP("ISO", "Kirghiz"),
|
|
||||||
"la" : QT_TRANSLATE_NOOP("ISO", "Latin"),
|
|
||||||
"lb" : QT_TRANSLATE_NOOP("ISO", "Luxembourgish"),
|
|
||||||
"lg" : QT_TRANSLATE_NOOP("ISO", "Ganda"),
|
|
||||||
"li" : QT_TRANSLATE_NOOP("ISO", "Limburgan"),
|
|
||||||
"ln" : QT_TRANSLATE_NOOP("ISO", "Lingala"),
|
|
||||||
"lo" : QT_TRANSLATE_NOOP("ISO", "Lao"),
|
|
||||||
"lt" : QT_TRANSLATE_NOOP("ISO", "Lithuanian"),
|
|
||||||
"lu" : QT_TRANSLATE_NOOP("ISO", "Luba-Katanga"),
|
|
||||||
"lv" : QT_TRANSLATE_NOOP("ISO", "Latvian"),
|
|
||||||
"mg" : QT_TRANSLATE_NOOP("ISO", "Malagasy"),
|
|
||||||
"mh" : QT_TRANSLATE_NOOP("ISO", "Marshallese"),
|
|
||||||
"mi" : QT_TRANSLATE_NOOP("ISO", "Maori"),
|
|
||||||
"mk" : QT_TRANSLATE_NOOP("ISO", "Macedonian"),
|
|
||||||
"ml" : QT_TRANSLATE_NOOP("ISO", "Malayalam"),
|
|
||||||
"mn" : QT_TRANSLATE_NOOP("ISO", "Mongolian"),
|
|
||||||
"mr" : QT_TRANSLATE_NOOP("ISO", "Marathi"),
|
|
||||||
"ms" : QT_TRANSLATE_NOOP("ISO", "Malay"),
|
|
||||||
"mt" : QT_TRANSLATE_NOOP("ISO", "Maltese"),
|
|
||||||
"my" : QT_TRANSLATE_NOOP("ISO", "Burmese"),
|
|
||||||
"na" : QT_TRANSLATE_NOOP("ISO", "Nauru"),
|
|
||||||
"nb" : QT_TRANSLATE_NOOP("ISO", "Norwegian Bokm\u0229l"),
|
|
||||||
"nd" : QT_TRANSLATE_NOOP("ISO", "North Ndebele"),
|
|
||||||
"ne" : QT_TRANSLATE_NOOP("ISO", "Nepali"),
|
|
||||||
"ng" : QT_TRANSLATE_NOOP("ISO", "Ndonga"),
|
|
||||||
"nl" : QT_TRANSLATE_NOOP("ISO", "Dutch"),
|
|
||||||
"nn" : QT_TRANSLATE_NOOP("ISO", "Norwegian Nynorsk"),
|
|
||||||
"no" : QT_TRANSLATE_NOOP("ISO", "Norwegian"),
|
|
||||||
"nr" : QT_TRANSLATE_NOOP("ISO", "South Ndebele"),
|
|
||||||
"nv" : QT_TRANSLATE_NOOP("ISO", "Navajo"),
|
|
||||||
"ny" : QT_TRANSLATE_NOOP("ISO", "Chichewa"),
|
|
||||||
"oc" : QT_TRANSLATE_NOOP("ISO", "Occitan"),
|
|
||||||
"oj" : QT_TRANSLATE_NOOP("ISO", "Ojibwa"),
|
|
||||||
"om" : QT_TRANSLATE_NOOP("ISO", "Oromo"),
|
|
||||||
"or" : QT_TRANSLATE_NOOP("ISO", "Oriya"),
|
|
||||||
"os" : QT_TRANSLATE_NOOP("ISO", "Ossetian"),
|
|
||||||
"pa" : QT_TRANSLATE_NOOP("ISO", "Panjabi"),
|
|
||||||
"pi" : QT_TRANSLATE_NOOP("ISO", "Pali"),
|
|
||||||
"pl" : QT_TRANSLATE_NOOP("ISO", "Polish"),
|
|
||||||
"ps" : QT_TRANSLATE_NOOP("ISO", "Pushto"),
|
|
||||||
"pt" : QT_TRANSLATE_NOOP("ISO", "Portuguese"),
|
|
||||||
"qu" : QT_TRANSLATE_NOOP("ISO", "Quechua"),
|
|
||||||
"rm" : QT_TRANSLATE_NOOP("ISO", "Romansh"),
|
|
||||||
"rn" : QT_TRANSLATE_NOOP("ISO", "Rundi"),
|
|
||||||
"ro" : QT_TRANSLATE_NOOP("ISO", "Romanian"),
|
|
||||||
"ru" : QT_TRANSLATE_NOOP("ISO", "Russian"),
|
|
||||||
"rw" : QT_TRANSLATE_NOOP("ISO", "Kinyarwanda"),
|
|
||||||
"sa" : QT_TRANSLATE_NOOP("ISO", "Sanskrit"),
|
|
||||||
"sc" : QT_TRANSLATE_NOOP("ISO", "Sardinian"),
|
|
||||||
"sd" : QT_TRANSLATE_NOOP("ISO", "Sindhi"),
|
|
||||||
"se" : QT_TRANSLATE_NOOP("ISO", "Northern Sami"),
|
|
||||||
"sg" : QT_TRANSLATE_NOOP("ISO", "Sango"),
|
|
||||||
"si" : QT_TRANSLATE_NOOP("ISO", "Sinhala"),
|
|
||||||
"sk" : QT_TRANSLATE_NOOP("ISO", "Slovak"),
|
|
||||||
"sl" : QT_TRANSLATE_NOOP("ISO", "Slovenian"),
|
|
||||||
"sm" : QT_TRANSLATE_NOOP("ISO", "Samoan"),
|
|
||||||
"sn" : QT_TRANSLATE_NOOP("ISO", "Shona"),
|
|
||||||
"so" : QT_TRANSLATE_NOOP("ISO", "Somali"),
|
|
||||||
"sq" : QT_TRANSLATE_NOOP("ISO", "Albanian"),
|
|
||||||
"sr" : QT_TRANSLATE_NOOP("ISO", "Serbian"),
|
|
||||||
"ss" : QT_TRANSLATE_NOOP("ISO", "Swati"),
|
|
||||||
"st" : QT_TRANSLATE_NOOP("ISO", "Southern Sotho"),
|
|
||||||
"su" : QT_TRANSLATE_NOOP("ISO", "Sundanese"),
|
|
||||||
"sv" : QT_TRANSLATE_NOOP("ISO", "Swedish"),
|
|
||||||
"sw" : QT_TRANSLATE_NOOP("ISO", "Swahili"),
|
|
||||||
"ta" : QT_TRANSLATE_NOOP("ISO", "Tamil"),
|
|
||||||
"te" : QT_TRANSLATE_NOOP("ISO", "Telugu"),
|
|
||||||
"tg" : QT_TRANSLATE_NOOP("ISO", "Tajik"),
|
|
||||||
"th" : QT_TRANSLATE_NOOP("ISO", "Thai"),
|
|
||||||
"ti" : QT_TRANSLATE_NOOP("ISO", "Tigrinya"),
|
|
||||||
"tk" : QT_TRANSLATE_NOOP("ISO", "Turkmen"),
|
|
||||||
"tl" : QT_TRANSLATE_NOOP("ISO", "Tagalog"),
|
|
||||||
"tn" : QT_TRANSLATE_NOOP("ISO", "Tswana"),
|
|
||||||
"to" : QT_TRANSLATE_NOOP("ISO", "Tonga"),
|
|
||||||
"tr" : QT_TRANSLATE_NOOP("ISO", "Turkish"),
|
|
||||||
"ts" : QT_TRANSLATE_NOOP("ISO", "Tsonga"),
|
|
||||||
"tt" : QT_TRANSLATE_NOOP("ISO", "Tatar"),
|
|
||||||
"tw" : QT_TRANSLATE_NOOP("ISO", "Twi"),
|
|
||||||
"ty" : QT_TRANSLATE_NOOP("ISO", "Tahitian"),
|
|
||||||
"ug" : QT_TRANSLATE_NOOP("ISO", "Uighur"),
|
|
||||||
"uk" : QT_TRANSLATE_NOOP("ISO", "Ukrainian"),
|
|
||||||
"ur" : QT_TRANSLATE_NOOP("ISO", "Urdu"),
|
|
||||||
"uz" : QT_TRANSLATE_NOOP("ISO", "Uzbek"),
|
|
||||||
"ve" : QT_TRANSLATE_NOOP("ISO", "Venda"),
|
|
||||||
"vi" : QT_TRANSLATE_NOOP("ISO", "Vietnamese"),
|
|
||||||
"vo" : QT_TRANSLATE_NOOP("ISO", "Volap\u00fck"),
|
|
||||||
"wa" : QT_TRANSLATE_NOOP("ISO", "Walloon"),
|
|
||||||
"wo" : QT_TRANSLATE_NOOP("ISO", "Wolof"),
|
|
||||||
"xh" : QT_TRANSLATE_NOOP("ISO", "Xhosa"),
|
|
||||||
"yi" : QT_TRANSLATE_NOOP("ISO", "Yiddish"),
|
|
||||||
"yo" : QT_TRANSLATE_NOOP("ISO", "Yoruba"),
|
|
||||||
"za" : QT_TRANSLATE_NOOP("ISO", "Zhuang"),
|
|
||||||
"zh" : QT_TRANSLATE_NOOP("ISO", "Chinese"),
|
|
||||||
"zu" : QT_TRANSLATE_NOOP("ISO", "Zulu"),
|
|
||||||
}
|
|
||||||
|
|
||||||
# END Class isoLanguage
|
|
||||||
|
|
||||||
class isoCountry():
|
|
||||||
|
|
||||||
ISO_3166_1_alpha_2 = {
|
|
||||||
"AD" : QT_TRANSLATE_NOOP("ISO", "Andorra"),
|
|
||||||
"AE" : QT_TRANSLATE_NOOP("ISO", "United Arab Emirates"),
|
|
||||||
"AF" : QT_TRANSLATE_NOOP("ISO", "Afghanistan"),
|
|
||||||
"AG" : QT_TRANSLATE_NOOP("ISO", "Antigua and Barbuda"),
|
|
||||||
"AI" : QT_TRANSLATE_NOOP("ISO", "Anguilla"),
|
|
||||||
"AL" : QT_TRANSLATE_NOOP("ISO", "Albania"),
|
|
||||||
"AM" : QT_TRANSLATE_NOOP("ISO", "Armenia"),
|
|
||||||
"AO" : QT_TRANSLATE_NOOP("ISO", "Angola"),
|
|
||||||
"AQ" : QT_TRANSLATE_NOOP("ISO", "Antarctica"),
|
|
||||||
"AR" : QT_TRANSLATE_NOOP("ISO", "Argentina"),
|
|
||||||
"AS" : QT_TRANSLATE_NOOP("ISO", "American Samoa"),
|
|
||||||
"AT" : QT_TRANSLATE_NOOP("ISO", "Austria"),
|
|
||||||
"AU" : QT_TRANSLATE_NOOP("ISO", "Australia"),
|
|
||||||
"AW" : QT_TRANSLATE_NOOP("ISO", "Aruba"),
|
|
||||||
"AX" : QT_TRANSLATE_NOOP("ISO", "\u0197land Islands"),
|
|
||||||
"AZ" : QT_TRANSLATE_NOOP("ISO", "Azerbaijan"),
|
|
||||||
"BA" : QT_TRANSLATE_NOOP("ISO", "Bosnia and Herzegovina"),
|
|
||||||
"BB" : QT_TRANSLATE_NOOP("ISO", "Barbados"),
|
|
||||||
"BD" : QT_TRANSLATE_NOOP("ISO", "Bangladesh"),
|
|
||||||
"BE" : QT_TRANSLATE_NOOP("ISO", "Belgium"),
|
|
||||||
"BF" : QT_TRANSLATE_NOOP("ISO", "Burkina Faso"),
|
|
||||||
"BG" : QT_TRANSLATE_NOOP("ISO", "Bulgaria"),
|
|
||||||
"BH" : QT_TRANSLATE_NOOP("ISO", "Bahrain"),
|
|
||||||
"BI" : QT_TRANSLATE_NOOP("ISO", "Burundi"),
|
|
||||||
"BJ" : QT_TRANSLATE_NOOP("ISO", "Benin"),
|
|
||||||
"BL" : QT_TRANSLATE_NOOP("ISO", "Saint Barth\u00e9lemy"),
|
|
||||||
"BM" : QT_TRANSLATE_NOOP("ISO", "Bermuda"),
|
|
||||||
"BN" : QT_TRANSLATE_NOOP("ISO", "Brunei Darussalam"),
|
|
||||||
"BO" : QT_TRANSLATE_NOOP("ISO", "Plurinational State of Bolivia"),
|
|
||||||
"BQ" : QT_TRANSLATE_NOOP("ISO", "Sint Eustatius and Saba Bonaire"),
|
|
||||||
"BR" : QT_TRANSLATE_NOOP("ISO", "Brazil"),
|
|
||||||
"BS" : QT_TRANSLATE_NOOP("ISO", "Bahamas"),
|
|
||||||
"BT" : QT_TRANSLATE_NOOP("ISO", "Bhutan"),
|
|
||||||
"BV" : QT_TRANSLATE_NOOP("ISO", "Bouvet Island"),
|
|
||||||
"BW" : QT_TRANSLATE_NOOP("ISO", "Botswana"),
|
|
||||||
"BY" : QT_TRANSLATE_NOOP("ISO", "Belarus"),
|
|
||||||
"BZ" : QT_TRANSLATE_NOOP("ISO", "Belize"),
|
|
||||||
"CA" : QT_TRANSLATE_NOOP("ISO", "Canada"),
|
|
||||||
"CC" : QT_TRANSLATE_NOOP("ISO", "Cocos (Keeling) Islands"),
|
|
||||||
"CD" : QT_TRANSLATE_NOOP("ISO", "The Democratic Republic of the Congo"),
|
|
||||||
"CF" : QT_TRANSLATE_NOOP("ISO", "Central African Republic"),
|
|
||||||
"CG" : QT_TRANSLATE_NOOP("ISO", "Congo"),
|
|
||||||
"CH" : QT_TRANSLATE_NOOP("ISO", "Switzerland"),
|
|
||||||
"CI" : QT_TRANSLATE_NOOP("ISO", "C\u00f4te d'Ivoire"),
|
|
||||||
"CK" : QT_TRANSLATE_NOOP("ISO", "Cook Islands"),
|
|
||||||
"CL" : QT_TRANSLATE_NOOP("ISO", "Chile"),
|
|
||||||
"CM" : QT_TRANSLATE_NOOP("ISO", "Cameroon"),
|
|
||||||
"CN" : QT_TRANSLATE_NOOP("ISO", "China"),
|
|
||||||
"CO" : QT_TRANSLATE_NOOP("ISO", "Colombia"),
|
|
||||||
"CR" : QT_TRANSLATE_NOOP("ISO", "Costa Rica"),
|
|
||||||
"CU" : QT_TRANSLATE_NOOP("ISO", "Cuba"),
|
|
||||||
"CV" : QT_TRANSLATE_NOOP("ISO", "Cape Verde"),
|
|
||||||
"CW" : QT_TRANSLATE_NOOP("ISO", "Cura\u00e7ao"),
|
|
||||||
"CX" : QT_TRANSLATE_NOOP("ISO", "Christmas Island"),
|
|
||||||
"CY" : QT_TRANSLATE_NOOP("ISO", "Cyprus"),
|
|
||||||
"CZ" : QT_TRANSLATE_NOOP("ISO", "Czech Republic"),
|
|
||||||
"DE" : QT_TRANSLATE_NOOP("ISO", "Germany"),
|
|
||||||
"DJ" : QT_TRANSLATE_NOOP("ISO", "Djibouti"),
|
|
||||||
"DK" : QT_TRANSLATE_NOOP("ISO", "Denmark"),
|
|
||||||
"DM" : QT_TRANSLATE_NOOP("ISO", "Dominica"),
|
|
||||||
"DO" : QT_TRANSLATE_NOOP("ISO", "Dominican Republic"),
|
|
||||||
"DZ" : QT_TRANSLATE_NOOP("ISO", "Algeria"),
|
|
||||||
"EC" : QT_TRANSLATE_NOOP("ISO", "Ecuador"),
|
|
||||||
"EE" : QT_TRANSLATE_NOOP("ISO", "Estonia"),
|
|
||||||
"EG" : QT_TRANSLATE_NOOP("ISO", "Egypt"),
|
|
||||||
"EH" : QT_TRANSLATE_NOOP("ISO", "Western Sahara"),
|
|
||||||
"ER" : QT_TRANSLATE_NOOP("ISO", "Eritrea"),
|
|
||||||
"ES" : QT_TRANSLATE_NOOP("ISO", "Spain"),
|
|
||||||
"ET" : QT_TRANSLATE_NOOP("ISO", "Ethiopia"),
|
|
||||||
"FI" : QT_TRANSLATE_NOOP("ISO", "Finland"),
|
|
||||||
"FJ" : QT_TRANSLATE_NOOP("ISO", "Fiji"),
|
|
||||||
"FK" : QT_TRANSLATE_NOOP("ISO", "Falkland Islands (Malvinas)"),
|
|
||||||
"FM" : QT_TRANSLATE_NOOP("ISO", "Federated States of Micronesia"),
|
|
||||||
"FO" : QT_TRANSLATE_NOOP("ISO", "Faroe Islands"),
|
|
||||||
"FR" : QT_TRANSLATE_NOOP("ISO", "France"),
|
|
||||||
"GA" : QT_TRANSLATE_NOOP("ISO", "Gabon"),
|
|
||||||
"GB" : QT_TRANSLATE_NOOP("ISO", "United Kingdom"),
|
|
||||||
"GD" : QT_TRANSLATE_NOOP("ISO", "Grenada"),
|
|
||||||
"GE" : QT_TRANSLATE_NOOP("ISO", "Georgia"),
|
|
||||||
"GF" : QT_TRANSLATE_NOOP("ISO", "French Guiana"),
|
|
||||||
"GG" : QT_TRANSLATE_NOOP("ISO", "Guernsey"),
|
|
||||||
"GH" : QT_TRANSLATE_NOOP("ISO", "Ghana"),
|
|
||||||
"GI" : QT_TRANSLATE_NOOP("ISO", "Gibraltar"),
|
|
||||||
"GL" : QT_TRANSLATE_NOOP("ISO", "Greenland"),
|
|
||||||
"GM" : QT_TRANSLATE_NOOP("ISO", "Gambia"),
|
|
||||||
"GN" : QT_TRANSLATE_NOOP("ISO", "Guinea"),
|
|
||||||
"GP" : QT_TRANSLATE_NOOP("ISO", "Guadeloupe"),
|
|
||||||
"GQ" : QT_TRANSLATE_NOOP("ISO", "Equatorial Guinea"),
|
|
||||||
"GR" : QT_TRANSLATE_NOOP("ISO", "Greece"),
|
|
||||||
"GS" : QT_TRANSLATE_NOOP("ISO", "South Georgia and the South Sandwich Islands"),
|
|
||||||
"GT" : QT_TRANSLATE_NOOP("ISO", "Guatemala"),
|
|
||||||
"GU" : QT_TRANSLATE_NOOP("ISO", "Guam"),
|
|
||||||
"GW" : QT_TRANSLATE_NOOP("ISO", "Guinea-Bissau"),
|
|
||||||
"GY" : QT_TRANSLATE_NOOP("ISO", "Guyana"),
|
|
||||||
"HK" : QT_TRANSLATE_NOOP("ISO", "Hong Kong"),
|
|
||||||
"HM" : QT_TRANSLATE_NOOP("ISO", "Heard Island and McDonald Islands"),
|
|
||||||
"HN" : QT_TRANSLATE_NOOP("ISO", "Honduras"),
|
|
||||||
"HR" : QT_TRANSLATE_NOOP("ISO", "Croatia"),
|
|
||||||
"HT" : QT_TRANSLATE_NOOP("ISO", "Haiti"),
|
|
||||||
"HU" : QT_TRANSLATE_NOOP("ISO", "Hungary"),
|
|
||||||
"ID" : QT_TRANSLATE_NOOP("ISO", "Indonesia"),
|
|
||||||
"IE" : QT_TRANSLATE_NOOP("ISO", "Ireland"),
|
|
||||||
"IL" : QT_TRANSLATE_NOOP("ISO", "Israel"),
|
|
||||||
"IM" : QT_TRANSLATE_NOOP("ISO", "Isle of Man"),
|
|
||||||
"IN" : QT_TRANSLATE_NOOP("ISO", "India"),
|
|
||||||
"IO" : QT_TRANSLATE_NOOP("ISO", "British Indian Ocean Territory"),
|
|
||||||
"IQ" : QT_TRANSLATE_NOOP("ISO", "Iraq"),
|
|
||||||
"IR" : QT_TRANSLATE_NOOP("ISO", "Islamic Republic of Iran"),
|
|
||||||
"IS" : QT_TRANSLATE_NOOP("ISO", "Iceland"),
|
|
||||||
"IT" : QT_TRANSLATE_NOOP("ISO", "Italy"),
|
|
||||||
"JE" : QT_TRANSLATE_NOOP("ISO", "Jersey"),
|
|
||||||
"JM" : QT_TRANSLATE_NOOP("ISO", "Jamaica"),
|
|
||||||
"JO" : QT_TRANSLATE_NOOP("ISO", "Jordan"),
|
|
||||||
"JP" : QT_TRANSLATE_NOOP("ISO", "Japan"),
|
|
||||||
"KE" : QT_TRANSLATE_NOOP("ISO", "Kenya"),
|
|
||||||
"KG" : QT_TRANSLATE_NOOP("ISO", "Kyrgyzstan"),
|
|
||||||
"KH" : QT_TRANSLATE_NOOP("ISO", "Cambodia"),
|
|
||||||
"KI" : QT_TRANSLATE_NOOP("ISO", "Kiribati"),
|
|
||||||
"KM" : QT_TRANSLATE_NOOP("ISO", "Comoros"),
|
|
||||||
"KN" : QT_TRANSLATE_NOOP("ISO", "Saint Kitts and Nevis"),
|
|
||||||
"KP" : QT_TRANSLATE_NOOP("ISO", "Democratic People's Republic of Korea"),
|
|
||||||
"KR" : QT_TRANSLATE_NOOP("ISO", "Republic of Korea"),
|
|
||||||
"KW" : QT_TRANSLATE_NOOP("ISO", "Kuwait"),
|
|
||||||
"KY" : QT_TRANSLATE_NOOP("ISO", "Cayman Islands"),
|
|
||||||
"KZ" : QT_TRANSLATE_NOOP("ISO", "Kazakhstan"),
|
|
||||||
"LA" : QT_TRANSLATE_NOOP("ISO", "Lao People's Democratic Republic"),
|
|
||||||
"LB" : QT_TRANSLATE_NOOP("ISO", "Lebanon"),
|
|
||||||
"LC" : QT_TRANSLATE_NOOP("ISO", "Saint Lucia"),
|
|
||||||
"LI" : QT_TRANSLATE_NOOP("ISO", "Liechtenstein"),
|
|
||||||
"LK" : QT_TRANSLATE_NOOP("ISO", "Sri Lanka"),
|
|
||||||
"LR" : QT_TRANSLATE_NOOP("ISO", "Liberia"),
|
|
||||||
"LS" : QT_TRANSLATE_NOOP("ISO", "Lesotho"),
|
|
||||||
"LT" : QT_TRANSLATE_NOOP("ISO", "Lithuania"),
|
|
||||||
"LU" : QT_TRANSLATE_NOOP("ISO", "Luxembourg"),
|
|
||||||
"LV" : QT_TRANSLATE_NOOP("ISO", "Latvia"),
|
|
||||||
"LY" : QT_TRANSLATE_NOOP("ISO", "Libya"),
|
|
||||||
"MA" : QT_TRANSLATE_NOOP("ISO", "Morocco"),
|
|
||||||
"MC" : QT_TRANSLATE_NOOP("ISO", "Monaco"),
|
|
||||||
"MD" : QT_TRANSLATE_NOOP("ISO", "Republic of Moldova"),
|
|
||||||
"ME" : QT_TRANSLATE_NOOP("ISO", "Montenegro"),
|
|
||||||
"MF" : QT_TRANSLATE_NOOP("ISO", "Saint Martin (French part)"),
|
|
||||||
"MG" : QT_TRANSLATE_NOOP("ISO", "Madagascar"),
|
|
||||||
"MH" : QT_TRANSLATE_NOOP("ISO", "Marshall Islands"),
|
|
||||||
"MK" : QT_TRANSLATE_NOOP("ISO", "The Former Yugoslav Republic of Macedonia"),
|
|
||||||
"ML" : QT_TRANSLATE_NOOP("ISO", "Mali"),
|
|
||||||
"MM" : QT_TRANSLATE_NOOP("ISO", "Myanmar"),
|
|
||||||
"MN" : QT_TRANSLATE_NOOP("ISO", "Mongolia"),
|
|
||||||
"MO" : QT_TRANSLATE_NOOP("ISO", "Macao"),
|
|
||||||
"MP" : QT_TRANSLATE_NOOP("ISO", "Northern Mariana Islands"),
|
|
||||||
"MQ" : QT_TRANSLATE_NOOP("ISO", "Martinique"),
|
|
||||||
"MR" : QT_TRANSLATE_NOOP("ISO", "Mauritania"),
|
|
||||||
"MS" : QT_TRANSLATE_NOOP("ISO", "Montserrat"),
|
|
||||||
"MT" : QT_TRANSLATE_NOOP("ISO", "Malta"),
|
|
||||||
"MU" : QT_TRANSLATE_NOOP("ISO", "Mauritius"),
|
|
||||||
"MV" : QT_TRANSLATE_NOOP("ISO", "Maldives"),
|
|
||||||
"MW" : QT_TRANSLATE_NOOP("ISO", "Malawi"),
|
|
||||||
"MX" : QT_TRANSLATE_NOOP("ISO", "Mexico"),
|
|
||||||
"MY" : QT_TRANSLATE_NOOP("ISO", "Malaysia"),
|
|
||||||
"MZ" : QT_TRANSLATE_NOOP("ISO", "Mozambique"),
|
|
||||||
"NA" : QT_TRANSLATE_NOOP("ISO", "Namibia"),
|
|
||||||
"NC" : QT_TRANSLATE_NOOP("ISO", "New Caledonia"),
|
|
||||||
"NE" : QT_TRANSLATE_NOOP("ISO", "Niger"),
|
|
||||||
"NF" : QT_TRANSLATE_NOOP("ISO", "Norfolk Island"),
|
|
||||||
"NG" : QT_TRANSLATE_NOOP("ISO", "Nigeria"),
|
|
||||||
"NI" : QT_TRANSLATE_NOOP("ISO", "Nicaragua"),
|
|
||||||
"NL" : QT_TRANSLATE_NOOP("ISO", "Netherlands"),
|
|
||||||
"NO" : QT_TRANSLATE_NOOP("ISO", "Norway"),
|
|
||||||
"NP" : QT_TRANSLATE_NOOP("ISO", "Nepal"),
|
|
||||||
"NR" : QT_TRANSLATE_NOOP("ISO", "Nauru"),
|
|
||||||
"NU" : QT_TRANSLATE_NOOP("ISO", "Niue"),
|
|
||||||
"NZ" : QT_TRANSLATE_NOOP("ISO", "New Zealand"),
|
|
||||||
"OM" : QT_TRANSLATE_NOOP("ISO", "Oman"),
|
|
||||||
"PA" : QT_TRANSLATE_NOOP("ISO", "Panama"),
|
|
||||||
"PE" : QT_TRANSLATE_NOOP("ISO", "Peru"),
|
|
||||||
"PF" : QT_TRANSLATE_NOOP("ISO", "French Polynesia"),
|
|
||||||
"PG" : QT_TRANSLATE_NOOP("ISO", "Papua New Guinea"),
|
|
||||||
"PH" : QT_TRANSLATE_NOOP("ISO", "Philippines"),
|
|
||||||
"PK" : QT_TRANSLATE_NOOP("ISO", "Pakistan"),
|
|
||||||
"PL" : QT_TRANSLATE_NOOP("ISO", "Poland"),
|
|
||||||
"PM" : QT_TRANSLATE_NOOP("ISO", "Saint Pierre and Miquelon"),
|
|
||||||
"PN" : QT_TRANSLATE_NOOP("ISO", "Pitcairn"),
|
|
||||||
"PR" : QT_TRANSLATE_NOOP("ISO", "Puerto Rico"),
|
|
||||||
"PS" : QT_TRANSLATE_NOOP("ISO", "State of Palestine"),
|
|
||||||
"PT" : QT_TRANSLATE_NOOP("ISO", "Portugal"),
|
|
||||||
"PW" : QT_TRANSLATE_NOOP("ISO", "Palau"),
|
|
||||||
"PY" : QT_TRANSLATE_NOOP("ISO", "Paraguay"),
|
|
||||||
"QA" : QT_TRANSLATE_NOOP("ISO", "Qatar"),
|
|
||||||
"RE" : QT_TRANSLATE_NOOP("ISO", "R\u00e9union"),
|
|
||||||
"RO" : QT_TRANSLATE_NOOP("ISO", "Romania"),
|
|
||||||
"RS" : QT_TRANSLATE_NOOP("ISO", "Serbia"),
|
|
||||||
"RU" : QT_TRANSLATE_NOOP("ISO", "Russian Federation"),
|
|
||||||
"RW" : QT_TRANSLATE_NOOP("ISO", "Rwanda"),
|
|
||||||
"SA" : QT_TRANSLATE_NOOP("ISO", "Saudi Arabia"),
|
|
||||||
"SB" : QT_TRANSLATE_NOOP("ISO", "Solomon Islands"),
|
|
||||||
"SC" : QT_TRANSLATE_NOOP("ISO", "Seychelles"),
|
|
||||||
"SD" : QT_TRANSLATE_NOOP("ISO", "Sudan"),
|
|
||||||
"SE" : QT_TRANSLATE_NOOP("ISO", "Sweden"),
|
|
||||||
"SG" : QT_TRANSLATE_NOOP("ISO", "Singapore"),
|
|
||||||
"SH" : QT_TRANSLATE_NOOP("ISO", "Saint Helena, Ascension and Tristan da Cunha"),
|
|
||||||
"SI" : QT_TRANSLATE_NOOP("ISO", "Slovenia"),
|
|
||||||
"SJ" : QT_TRANSLATE_NOOP("ISO", "Svalbard and Jan Mayen"),
|
|
||||||
"SK" : QT_TRANSLATE_NOOP("ISO", "Slovakia"),
|
|
||||||
"SL" : QT_TRANSLATE_NOOP("ISO", "Sierra Leone"),
|
|
||||||
"SM" : QT_TRANSLATE_NOOP("ISO", "San Marino"),
|
|
||||||
"SN" : QT_TRANSLATE_NOOP("ISO", "Senegal"),
|
|
||||||
"SO" : QT_TRANSLATE_NOOP("ISO", "Somalia"),
|
|
||||||
"SR" : QT_TRANSLATE_NOOP("ISO", "Suriname"),
|
|
||||||
"SS" : QT_TRANSLATE_NOOP("ISO", "South Sudan"),
|
|
||||||
"ST" : QT_TRANSLATE_NOOP("ISO", "Sao Tome and Principe"),
|
|
||||||
"SV" : QT_TRANSLATE_NOOP("ISO", "El Salvador"),
|
|
||||||
"SX" : QT_TRANSLATE_NOOP("ISO", "Sint Maarten"),
|
|
||||||
"SY" : QT_TRANSLATE_NOOP("ISO", "Syrian Arab Republic"),
|
|
||||||
"SZ" : QT_TRANSLATE_NOOP("ISO", "Swaziland"),
|
|
||||||
"TC" : QT_TRANSLATE_NOOP("ISO", "Turks and Caicos Islands"),
|
|
||||||
"TD" : QT_TRANSLATE_NOOP("ISO", "Chad"),
|
|
||||||
"TF" : QT_TRANSLATE_NOOP("ISO", "French Southern Territories"),
|
|
||||||
"TG" : QT_TRANSLATE_NOOP("ISO", "Togo"),
|
|
||||||
"TH" : QT_TRANSLATE_NOOP("ISO", "Thailand"),
|
|
||||||
"TJ" : QT_TRANSLATE_NOOP("ISO", "Tajikistan"),
|
|
||||||
"TK" : QT_TRANSLATE_NOOP("ISO", "Tokelau"),
|
|
||||||
"TL" : QT_TRANSLATE_NOOP("ISO", "Timor-Leste"),
|
|
||||||
"TM" : QT_TRANSLATE_NOOP("ISO", "Turkmenistan"),
|
|
||||||
"TN" : QT_TRANSLATE_NOOP("ISO", "Tunisia"),
|
|
||||||
"TO" : QT_TRANSLATE_NOOP("ISO", "Tonga"),
|
|
||||||
"TR" : QT_TRANSLATE_NOOP("ISO", "Turkey"),
|
|
||||||
"TT" : QT_TRANSLATE_NOOP("ISO", "Trinidad and Tobago"),
|
|
||||||
"TV" : QT_TRANSLATE_NOOP("ISO", "Tuvalu"),
|
|
||||||
"TW" : QT_TRANSLATE_NOOP("ISO", "Taiwan, Province of China"),
|
|
||||||
"TZ" : QT_TRANSLATE_NOOP("ISO", "United Republic of Tanzania"),
|
|
||||||
"UA" : QT_TRANSLATE_NOOP("ISO", "Ukraine"),
|
|
||||||
"UG" : QT_TRANSLATE_NOOP("ISO", "Uganda"),
|
|
||||||
"UM" : QT_TRANSLATE_NOOP("ISO", "United States Minor Outlying Islands"),
|
|
||||||
"US" : QT_TRANSLATE_NOOP("ISO", "United States"),
|
|
||||||
"UY" : QT_TRANSLATE_NOOP("ISO", "Uruguay"),
|
|
||||||
"UZ" : QT_TRANSLATE_NOOP("ISO", "Uzbekistan"),
|
|
||||||
"VA" : QT_TRANSLATE_NOOP("ISO", "Holy See (Vatican City State)"),
|
|
||||||
"VC" : QT_TRANSLATE_NOOP("ISO", "Saint Vincent and the Grenadines"),
|
|
||||||
"VE" : QT_TRANSLATE_NOOP("ISO", "Bolivarian Republic of Venezuela"),
|
|
||||||
"VG" : QT_TRANSLATE_NOOP("ISO", "British Virgin Islands"),
|
|
||||||
"VI" : QT_TRANSLATE_NOOP("ISO", "U.S. Virgin Islands"),
|
|
||||||
"VN" : QT_TRANSLATE_NOOP("ISO", "Viet Nam"),
|
|
||||||
"VU" : QT_TRANSLATE_NOOP("ISO", "Vanuatu"),
|
|
||||||
"WF" : QT_TRANSLATE_NOOP("ISO", "Wallis and Futuna"),
|
|
||||||
"WS" : QT_TRANSLATE_NOOP("ISO", "Samoa"),
|
|
||||||
"YE" : QT_TRANSLATE_NOOP("ISO", "Yemen"),
|
|
||||||
"YT" : QT_TRANSLATE_NOOP("ISO", "Mayotte"),
|
|
||||||
"ZA" : QT_TRANSLATE_NOOP("ISO", "South Africa"),
|
|
||||||
"ZM" : QT_TRANSLATE_NOOP("ISO", "Zambia"),
|
|
||||||
"ZW" : QT_TRANSLATE_NOOP("ISO", "Zimbabwe"),
|
|
||||||
}
|
|
||||||
|
|
||||||
# END Class isoCountry
|
|
||||||
+2
-45
@@ -24,14 +24,11 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from PyQt5.QtCore import QCoreApplication
|
|
||||||
import nw
|
import nw
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import difflib
|
import difflib
|
||||||
|
|
||||||
from nw.constants import nwConst, isoLanguage
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
@@ -85,21 +82,6 @@ class NWSpellCheck():
|
|||||||
"""
|
"""
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def describeDict(self):
|
|
||||||
"""Dummy function.
|
|
||||||
"""
|
|
||||||
return "", ""
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def expandLanguage(spTag):
|
|
||||||
"""Translate a language tag to something more user friendly.
|
|
||||||
"""
|
|
||||||
spBits = spTag.split("_")
|
|
||||||
spLang = QCoreApplication.translate("ISO", isoLanguage.ISO_639_1.get(spBits[0], spBits[0]))
|
|
||||||
if len(spBits) > 1:
|
|
||||||
spLang += " (%s)" % spBits[1]
|
|
||||||
return spLang
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Internal Functions
|
# Internal Functions
|
||||||
##
|
##
|
||||||
@@ -197,27 +179,11 @@ class NWSpellEnchant(NWSpellCheck):
|
|||||||
try:
|
try:
|
||||||
import enchant
|
import enchant
|
||||||
for spTag, spProvider in enchant.list_dicts():
|
for spTag, spProvider in enchant.list_dicts():
|
||||||
spName = "%s [%s]" % (self.expandLanguage(spTag), spProvider.name)
|
retList.append((spTag, spProvider.name))
|
||||||
retList.append((spTag, spName))
|
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.error("Failed to list languages for enchant spell checking")
|
logger.error("Failed to list languages for enchant spell checking")
|
||||||
return retList
|
return retList
|
||||||
|
|
||||||
def describeDict(self):
|
|
||||||
"""Return the tag and provider of the currently loaded
|
|
||||||
dictionary.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
spTag = self.theDict.tag
|
|
||||||
spName = self.theDict.provider.name
|
|
||||||
except Exception:
|
|
||||||
logger.error("Failed to extract information about the dictionary")
|
|
||||||
nw.logException()
|
|
||||||
spTag = ""
|
|
||||||
spName = ""
|
|
||||||
|
|
||||||
return spTag, spName
|
|
||||||
|
|
||||||
# END Class NWSpellEnchant
|
# END Class NWSpellEnchant
|
||||||
|
|
||||||
class NWSpellEnchantDummy:
|
class NWSpellEnchantDummy:
|
||||||
@@ -333,17 +299,8 @@ class NWSpellSimple(NWSpellCheck):
|
|||||||
if fExt != ".dict":
|
if fExt != ".dict":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
spName = "%s [%s]" % (
|
retList.append((fRoot, "difflib"))
|
||||||
self.expandLanguage(fRoot),
|
|
||||||
QCoreApplication.translate("Constant", nwConst.SP_INTERNAL))
|
|
||||||
retList.append((fRoot, spName))
|
|
||||||
|
|
||||||
return retList
|
return retList
|
||||||
|
|
||||||
def describeDict(self):
|
|
||||||
"""Return the tag and provider of the currently loaded
|
|
||||||
dictionary.
|
|
||||||
"""
|
|
||||||
return self.theLang, QCoreApplication.translate("Constant", nwConst.SP_INTERNAL)
|
|
||||||
|
|
||||||
# END Class NWSpellSimple
|
# END Class NWSpellSimple
|
||||||
|
|||||||
+1
-8
@@ -599,14 +599,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
theLang = self.theProject.projLang
|
theLang = self.theProject.projLang
|
||||||
|
|
||||||
self.theDict.setLanguage(theLang, self.theProject.projDict)
|
self.theDict.setLanguage(theLang, self.theProject.projDict)
|
||||||
|
self.theParent.statusBar.setLanguage(theLang)
|
||||||
aLang, aName = self.theDict.describeDict()
|
|
||||||
self.theParent.statusBar.setLanguage(
|
|
||||||
aLang,
|
|
||||||
self.tr("{0} [{1}]").format(
|
|
||||||
self.mainConf.spellTool.title(),
|
|
||||||
aName.title())
|
|
||||||
)
|
|
||||||
|
|
||||||
if not self.bigDoc:
|
if not self.bigDoc:
|
||||||
self.spellCheckDocument()
|
self.spellCheckDocument()
|
||||||
|
|||||||
+13
-9
@@ -28,7 +28,7 @@ import nw
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from PyQt5.QtCore import QCoreApplication, Qt
|
from PyQt5.QtCore import Qt, QLocale
|
||||||
from PyQt5.QtGui import QFont
|
from PyQt5.QtGui import QFont
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QDialog, QWidget, QComboBox, QSpinBox, QPushButton, QDialogButtonBox,
|
QDialog, QWidget, QComboBox, QSpinBox, QPushButton, QDialogButtonBox,
|
||||||
@@ -627,19 +627,20 @@ class GuiPreferencesEditor(QWidget):
|
|||||||
self.mainForm.setHelpTextStyle(self.theTheme.helpText)
|
self.mainForm.setHelpTextStyle(self.theTheme.helpText)
|
||||||
self.setLayout(self.mainForm)
|
self.setLayout(self.mainForm)
|
||||||
|
|
||||||
|
mW = self.mainConf.pxInt(250)
|
||||||
|
|
||||||
# Spell Checking
|
# Spell Checking
|
||||||
# ==============
|
# ==============
|
||||||
self.mainForm.addGroupLabel(self.tr("Spell Checking"))
|
self.mainForm.addGroupLabel(self.tr("Spell Checking"))
|
||||||
|
|
||||||
## Spell Check Provider and Language
|
## Spell Check Provider and Language
|
||||||
self.spellLangList = QComboBox(self)
|
self.spellLangList = QComboBox(self)
|
||||||
|
self.spellLangList.setMaximumWidth(mW)
|
||||||
|
|
||||||
self.spellToolList = QComboBox(self)
|
self.spellToolList = QComboBox(self)
|
||||||
self.spellToolList.addItem(
|
self.spellToolList.setMaximumWidth(mW)
|
||||||
self.tr("{0} ({1})").format(self.tr("Internal"), "difflib"),
|
self.spellToolList.addItem("%s (difflib)" % self.tr("Internal"), nwConst.SP_INTERNAL)
|
||||||
QCoreApplication.translate("Constant", nwConst.SP_INTERNAL))
|
self.spellToolList.addItem("Spell Enchant (pyenchant)", nwConst.SP_ENCHANT)
|
||||||
self.spellToolList.addItem(
|
|
||||||
self.tr("{0} ({1})").format(self.tr("Spell Enchant"), "pyenchant"),
|
|
||||||
QCoreApplication.translate("Constant", nwConst.SP_ENCHANT))
|
|
||||||
|
|
||||||
theModel = self.spellToolList.model()
|
theModel = self.spellToolList.model()
|
||||||
idEnchant = self.spellToolList.findData(nwConst.SP_ENCHANT)
|
idEnchant = self.spellToolList.findData(nwConst.SP_ENCHANT)
|
||||||
@@ -799,8 +800,11 @@ class GuiPreferencesEditor(QWidget):
|
|||||||
theDict = NWSpellSimple()
|
theDict = NWSpellSimple()
|
||||||
|
|
||||||
self.spellLangList.clear()
|
self.spellLangList.clear()
|
||||||
for spTag, spName in theDict.listDictionaries():
|
for spTag, spProv in theDict.listDictionaries():
|
||||||
self.spellLangList.addItem(spName, spTag)
|
qLocal = QLocale(spTag)
|
||||||
|
spLang = qLocal.nativeLanguageName().title()
|
||||||
|
spName = qLocal.bcp47Name()
|
||||||
|
self.spellLangList.addItem("%s (%s) [%s]" % (spLang, spName, spProv), spTag)
|
||||||
|
|
||||||
spellIdx = self.spellLangList.findData(self.mainConf.spellLanguage)
|
spellIdx = self.spellLangList.findData(self.mainConf.spellLanguage)
|
||||||
if spellIdx != -1:
|
if spellIdx != -1:
|
||||||
|
|||||||
+8
-10
@@ -29,10 +29,10 @@ import logging
|
|||||||
|
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
|
from PyQt5.QtCore import QLocale
|
||||||
from PyQt5.QtGui import QColor, QPainter
|
from PyQt5.QtGui import QColor, QPainter
|
||||||
from PyQt5.QtWidgets import qApp, QStatusBar, QLabel, QAbstractButton
|
from PyQt5.QtWidgets import qApp, QStatusBar, QLabel, QAbstractButton
|
||||||
|
|
||||||
from nw.core import NWSpellCheck
|
|
||||||
from nw.common import formatTime
|
from nw.common import formatTime
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -147,19 +147,17 @@ class GuiMainStatus(QStatusBar):
|
|||||||
qApp.processEvents()
|
qApp.processEvents()
|
||||||
return
|
return
|
||||||
|
|
||||||
def setLanguage(self, theLanguage, theProvider=""):
|
def setLanguage(self, theLang):
|
||||||
"""Set the language code for the spell checker.
|
"""Set the language code for the spell checker.
|
||||||
"""
|
"""
|
||||||
if theLanguage is None:
|
if theLang is None:
|
||||||
self.langText.setText(self.tr("None"))
|
self.langText.setText(self.tr("None"))
|
||||||
self.langText.setToolTip("")
|
|
||||||
else:
|
else:
|
||||||
self.langText.setText(NWSpellCheck.expandLanguage(theLanguage))
|
qLocal = QLocale(theLang)
|
||||||
self.langText.setToolTip(
|
spLang = qLocal.nativeLanguageName().title()
|
||||||
self.tr("{0}: {1}").format(
|
spName = qLocal.bcp47Name()
|
||||||
self.tr("Provider"),
|
self.langText.setText("%s (%s)" % (spLang, spName))
|
||||||
theProvider if theProvider else self.tr("unknown"))
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def setProjectStatus(self, isChanged):
|
def setProjectStatus(self, isChanged):
|
||||||
|
|||||||
@@ -46,11 +46,6 @@ def testCoreSpell_Super(monkeypatch, tmpDir, tmpConf):
|
|||||||
assert spChk.checkWord("")
|
assert spChk.checkWord("")
|
||||||
assert spChk.suggestWords("") == []
|
assert spChk.suggestWords("") == []
|
||||||
assert spChk.listDictionaries() == []
|
assert spChk.listDictionaries() == []
|
||||||
assert spChk.describeDict() == ("", "")
|
|
||||||
|
|
||||||
# Check language info
|
|
||||||
assert NWSpellCheck.expandLanguage("en") == "English"
|
|
||||||
assert NWSpellCheck.expandLanguage("en_GB") == "English (GB)"
|
|
||||||
|
|
||||||
# Add a word to the user's dictionary
|
# Add a word to the user's dictionary
|
||||||
assert spChk._readProjectDictionary("dummy") is False
|
assert spChk._readProjectDictionary("dummy") is False
|
||||||
@@ -92,7 +87,6 @@ def testCoreSpell_Enchant(monkeypatch, tmpDir, tmpConf):
|
|||||||
assert spChk.checkWord("")
|
assert spChk.checkWord("")
|
||||||
assert spChk.suggestWords("") == []
|
assert spChk.suggestWords("") == []
|
||||||
assert spChk.listDictionaries() == []
|
assert spChk.listDictionaries() == []
|
||||||
assert spChk.describeDict() == ("", "")
|
|
||||||
|
|
||||||
monkeypatch.undo()
|
monkeypatch.undo()
|
||||||
|
|
||||||
@@ -116,10 +110,6 @@ def testCoreSpell_Enchant(monkeypatch, tmpDir, tmpConf):
|
|||||||
dList = spChk.listDictionaries()
|
dList = spChk.listDictionaries()
|
||||||
assert len(dList) > 0
|
assert len(dList) > 0
|
||||||
|
|
||||||
aTag, aName = spChk.describeDict()
|
|
||||||
assert aTag == "en"
|
|
||||||
assert aName != ""
|
|
||||||
|
|
||||||
# END Test testCoreSpell_Enchant
|
# END Test testCoreSpell_Enchant
|
||||||
|
|
||||||
@pytest.mark.core
|
@pytest.mark.core
|
||||||
@@ -180,9 +170,4 @@ def testCoreSpell_Simple(monkeypatch, tmpDir, tmpConf):
|
|||||||
# List dictionaries
|
# List dictionaries
|
||||||
assert spChk.listDictionaries() == [("en", "English [%s]" % nwConst.SP_INTERNAL)]
|
assert spChk.listDictionaries() == [("en", "English [%s]" % nwConst.SP_INTERNAL)]
|
||||||
|
|
||||||
# Description
|
|
||||||
aTag, aName = spChk.describeDict()
|
|
||||||
assert aTag == "en"
|
|
||||||
assert aName == nwConst.SP_INTERNAL
|
|
||||||
|
|
||||||
# END Test testCoreSpell_Simple
|
# END Test testCoreSpell_Simple
|
||||||
|
|||||||
Reference in New Issue
Block a user