Assign correct codes to QLocale::AnyCountry and AnyScript
as their meaning, in fact, is unknown (or default) country/script. Change-Id: Id75a70d4b33c2092de414f3ac357f6bcb627ba47 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
1e0e5f2d68
commit
e4c2a5c29f
@ -5091,7 +5091,7 @@ static const unsigned char language_code_list[] =
|
|||||||
;
|
;
|
||||||
|
|
||||||
static const unsigned char script_code_list[] =
|
static const unsigned char script_code_list[] =
|
||||||
"\0\0\0\0" // AnyScript
|
"Zzzz" // AnyScript
|
||||||
"Arab" // Arabic
|
"Arab" // Arabic
|
||||||
"Cyrl" // Cyrillic
|
"Cyrl" // Cyrillic
|
||||||
"Dsrt" // Deseret
|
"Dsrt" // Deseret
|
||||||
@ -5128,7 +5128,7 @@ static const unsigned char script_code_list[] =
|
|||||||
"Yiii" // Yi
|
"Yiii" // Yi
|
||||||
;
|
;
|
||||||
static const unsigned char country_code_list[] =
|
static const unsigned char country_code_list[] =
|
||||||
" \0" // AnyCountry
|
"ZZ\0" // AnyCountry
|
||||||
"AF\0" // Afghanistan
|
"AF\0" // Afghanistan
|
||||||
"AL\0" // Albania
|
"AL\0" // Albania
|
||||||
"DZ\0" // Algeria
|
"DZ\0" // Algeria
|
||||||
|
@ -135,26 +135,22 @@ def generateLocaleInfo(path):
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
language_id = enumdata.languageCodeToId(language_code)
|
language_id = enumdata.languageCodeToId(language_code)
|
||||||
if language_id == -1:
|
if language_id <= 0:
|
||||||
sys.stderr.write("unknown language code \"" + language_code + "\"\n")
|
sys.stderr.write("unknown language code \"" + language_code + "\"\n")
|
||||||
return {}
|
return {}
|
||||||
language = enumdata.language_list[language_id][0]
|
language = enumdata.language_list[language_id][0]
|
||||||
|
|
||||||
script_id = enumdata.scriptCodeToId(script_code)
|
script_id = enumdata.scriptCodeToId(script_code)
|
||||||
if script_code == -1:
|
if script_id == -1:
|
||||||
sys.stderr.write("unknown script code \"" + script_code + "\"\n")
|
sys.stderr.write("unknown script code \"" + script_code + "\"\n")
|
||||||
return {}
|
return {}
|
||||||
script = "AnyScript"
|
|
||||||
if script_id != -1:
|
|
||||||
script = enumdata.script_list[script_id][0]
|
script = enumdata.script_list[script_id][0]
|
||||||
|
|
||||||
country_id = enumdata.countryCodeToId(country_code)
|
country_id = enumdata.countryCodeToId(country_code)
|
||||||
country = ""
|
if country_id <= 0:
|
||||||
if country_id != -1:
|
|
||||||
country = enumdata.country_list[country_id][0]
|
|
||||||
if country == "":
|
|
||||||
sys.stderr.write("unknown country code \"" + country_code + "\"\n")
|
sys.stderr.write("unknown country code \"" + country_code + "\"\n")
|
||||||
return {}
|
return {}
|
||||||
|
country = enumdata.country_list[country_id][0]
|
||||||
|
|
||||||
# So we say we accept only those values that have "contributed" or
|
# So we say we accept only those values that have "contributed" or
|
||||||
# "approved" resolution. see http://www.unicode.org/cldr/process.html
|
# "approved" resolution. see http://www.unicode.org/cldr/process.html
|
||||||
|
@ -264,7 +264,7 @@ language_list = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
country_list = {
|
country_list = {
|
||||||
0 : [ "AnyCountry", " " ],
|
0 : [ "AnyCountry", "ZZ" ],
|
||||||
1 : [ "Afghanistan", "AF" ],
|
1 : [ "Afghanistan", "AF" ],
|
||||||
2 : [ "Albania", "AL" ],
|
2 : [ "Albania", "AL" ],
|
||||||
3 : [ "Algeria", "DZ" ],
|
3 : [ "Algeria", "DZ" ],
|
||||||
@ -514,7 +514,7 @@ country_list = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
script_list = {
|
script_list = {
|
||||||
0 : [ "AnyScript", "" ],
|
0 : [ "AnyScript", "Zzzz" ],
|
||||||
1 : [ "Arabic", "Arab" ],
|
1 : [ "Arabic", "Arab" ],
|
||||||
2 : [ "Cyrillic", "Cyrl" ],
|
2 : [ "Cyrillic", "Cyrl" ],
|
||||||
3 : [ "Deseret", "Dsrt" ],
|
3 : [ "Deseret", "Dsrt" ],
|
||||||
@ -552,18 +552,24 @@ script_list = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def countryCodeToId(code):
|
def countryCodeToId(code):
|
||||||
|
if not code:
|
||||||
|
return 0
|
||||||
for country_id in country_list:
|
for country_id in country_list:
|
||||||
if country_list[country_id][1] == code:
|
if country_list[country_id][1] == code:
|
||||||
return country_id
|
return country_id
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def languageCodeToId(code):
|
def languageCodeToId(code):
|
||||||
|
if not code:
|
||||||
|
return 0
|
||||||
for language_id in language_list:
|
for language_id in language_list:
|
||||||
if language_list[language_id][1] == code:
|
if language_list[language_id][1] == code:
|
||||||
return language_id
|
return language_id
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def scriptCodeToId(code):
|
def scriptCodeToId(code):
|
||||||
|
if not code:
|
||||||
|
return 0
|
||||||
for script_id in script_list:
|
for script_id in script_list:
|
||||||
if script_list[script_id][1] == code:
|
if script_list[script_id][1] == code:
|
||||||
return script_id
|
return script_id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user