Skip to content

Commit 9b4d8d2

Browse files
authored
Merge pull request #149 from googlefonts/ci-tests
Make language names unique
2 parents 4f1f7c8 + 642b56c commit 9b4d8d2

19 files changed

+46
-33
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
id: "bdh_Latn"
22
language: "bdh"
33
script: "Latn"
4-
name: "Baka"
4+
name: "Baka (DRC/South Sudan)"
5+
autonym: "Tara Baká"
56
population: 60000
67
region: "CD"
78
region: "SS"
89
exemplar_chars {
910
base: "a A b B c C d D e E f F g G h H i I ị Ị ɨ Ɨ k K l L m M n N ṇ Ṇ o O p P r R ṛ Ṛ s S t T u U ụ Ụ v V ṿ Ṿ w W y Y z Z ꞌ Ꞌ"
1011
marks: "◌̣ ◌́"
11-
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
id: "beh_Latn"
22
language: "beh"
33
script: "Latn"
4-
name: "Baka"
4+
name: "Biali"
55
population: 100000
66
region: "BJ"
77
exemplar_chars {
88
base: "a A b B c C d D e E ə Ə f F g G h H i I k K l L m M n N o O p P r R s S t T u U w W y Y"
99
auxiliary: "j J q Q v V x X z Z"
10-
}
10+
}

Lib/gflanguages/data/languages/bgn_Arab.textproto

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ id: "bgn_Arab"
22
language: "bgn"
33
script: "Arab"
44
name: "Western Balochi"
5-
preferred_name: "Balochi"
5+
#preferred_name: "Balochi"
66
population: 2037382
77
region: "AF"
88
region: "IR"
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
id: "bkc_Latn"
22
language: "bkc"
33
script: "Latn"
4-
name: "Baka"
4+
name: "Baka (Cameroon/Gabon)"
55
population: 71000
66
region: "CM"
77
region: "GA"
88
exemplar_chars {
99
base: "a A b B ɓ Ɓ d D ɗ Ɗ e E ɛ Ɛ f F g G h H i I j J k K l L m M n N o O ɔ Ɔ s S t T u U w W y Y"
1010
auxiliary: "c C p P q Q r R v V x X z Z"
11-
}
11+
}

Lib/gflanguages/data/languages/bsc_Latn_GN.textproto

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id: "bsc_Latn_GN"
22
language: "bsc"
33
script: "Latn"
4-
name: "Bassari"
4+
name: "Guinean Bassari"
55
autonym: "oneyan"
66
population: 18000
77
region: "GN"

Lib/gflanguages/data/languages/bsq_Bass.textproto

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id: "bsq_Bass"
22
language: "bsq"
33
script: "Bass"
4-
name: "Bassa"
4+
name: "Bassa, Vah"
55
population: 410000
66
region: "LR"
77
region: "SL"
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id: "bsq_Latn"
22
language: "bsq"
33
script: "Latn"
4-
name: "Bassa"
4+
name: "Bassa, Latin"
55
population: 410000
66
region: "LR"
77
region: "SL"
@@ -11,4 +11,4 @@ exemplar_chars {
1111
auxiliary: "l L q Q r R x X y Y z Z"
1212
}
1313
source: "“Bassa dictionary”, Christian Education Foundation in Liberia (CEFL), https://cefliberia.org/bassa/bassa-dictionary/"
14-
source: "Ɓǎsɔ́ɔ̀ Báɓòɔ̀, Bible Society Liberia, 2002"
14+
source: "Ɓǎsɔ́ɔ̀ Báɓòɔ̀, Bible Society Liberia, 2002"

Lib/gflanguages/data/languages/crh_Cyrl.textproto

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id: "crh_Cyrl"
22
language: "crh"
33
script: "Cyrl"
4-
name: "Crimean Turkish"
4+
name: "Crimean Turkish, Cyrillic"
55
autonym: "Къырымтатар"
66
population: 245968
77
region: "UA"

Lib/gflanguages/data/languages/dnj_Latn_LR.textproto

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id: "dnj_Latn_LR"
22
language: "dnj"
33
script: "Latn"
4-
name: "Dan"
4+
name: "Liberian Dan"
55
autonym: "Gio"
66
population: 1099244
77
region: "LR"

Lib/gflanguages/data/languages/evn_Latn.textproto

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id: "evn_Latn"
22
language: "evn"
33
script: "Latn"
4-
name: "Evenki"
4+
name: "Evenki, Latin"
55
population: 16000
66
region: "RU"
77
region: "CN"
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
id: "kr_Arab"
22
language: "kr"
33
script: "Arab"
4-
name: "Kanuri"
4+
name: "Kanuri, Arabic"

Lib/gflanguages/data/languages/mlt_Latn.textproto

-11
This file was deleted.

Lib/gflanguages/data/languages/sa_Nand.textproto

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
id: "sa_Nand"
33
language: "sa"
44
script: "Nand"
5-
name: "Sanskrit"
5+
name: "Sanskrit, Nandinagari"
66
autonym: "𑧍𑧞𑧍𑧠𑦮𑧖𑦽𑧆𑧠"
77
region: "IN"
88
exemplar_chars {

Lib/gflanguages/data/languages/uma_Latn.textproto

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
id: "uma_Latn"
2+
language: "uma"
23
script: "Latn"
34
name: "Umatilla"
45
population: 25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
id: "wal_Ethi"
22
language: "wal"
33
script: "Ethi"
4-
name: "Wolaytta"
4+
name: "Wolaytta, Ethiopic"
55
population: 1946034
66
region: "ET"
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
id: "wal_Latn"
22
language: "wal"
33
script: "Latn"
4-
name: "Wolaytta"
4+
name: "Wolaytta, Latin"
55
population: 7000000
66
region: "ET"
77
exemplar_chars {
88
base: "a A b B c C d D e E f F g G h H i I j J k K l L m M n N o O p P q Q r R s S t T u U v V w W x X y Y z Z"
9-
}
9+
}

Lib/gflanguages/data/languages/xsm_Latn_BF.textproto

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id: "xsm_Latn_BF"
22
language: "xsm"
33
script: "Latn"
4-
name: "Kasem"
4+
name: "Burkinabè Kasem"
55
population: 250000
66
region: "BF"
77
exemplar_chars {

tests/test_data_languages.py

+15
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,18 @@ def test_exemplar_parser():
265265
"l",
266266
"̍",
267267
}
268+
269+
270+
def test_language_uniqueness():
271+
names = Counter([])
272+
for lang in LANGUAGES.values():
273+
# We check that names are unique *within a script* since
274+
# when we display them in a menu we segment that menu by
275+
# script and then by language
276+
if lang.preferred_name:
277+
names[lang.script + "/" + lang.preferred_name] += 1
278+
else:
279+
names[lang.name + "/" + lang.preferred_name] += 1
280+
if any(count > 1 for count in names.values()):
281+
duplicates = {name: count for name, count in names.items() if count > 1}
282+
pytest.fail(f"Duplicate language names: {duplicates}")

tests/test_parsable.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@
77

88

99
languages_dir = os.path.join(DATA_DIR, "languages")
10-
textproto_files = [os.path.basename(x) for x in glob.iglob(os.path.join(languages_dir, "*.textproto"))]
10+
textproto_files = [
11+
os.path.basename(x) for x in glob.iglob(os.path.join(languages_dir, "*.textproto"))
12+
]
13+
1114

1215
@pytest.mark.parametrize("lang_code", textproto_files)
1316
def test_parsable(lang_code):
1417
with open(os.path.join(languages_dir, lang_code), "r", encoding="utf-8") as f:
15-
text_format.Parse(f.read(), languages_public_pb2.LanguageProto())
18+
msg = text_format.Parse(f.read(), languages_public_pb2.LanguageProto())
19+
assert msg.id
20+
assert msg.language
21+
assert msg.script
22+
assert msg.population is not None

0 commit comments

Comments
 (0)