Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure language ID starts with language and script #185

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/gflanguages/data/languages/har_Latn.textproto
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
id: "har_Latn"
language: "ha"
language: "har"
script: "Latn"
name: "Harari"
population: 26000
Expand Down
2 changes: 1 addition & 1 deletion Lib/gflanguages/data/languages/mak_Maka.textproto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id: "mak_Maka"
language: "mak"
script: "Bugi"
script: "Maka"
name: "Makasar, Old Makasar"
population: 0
historical: true
Expand Down
9 changes: 9 additions & 0 deletions tests/test_data_languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,3 +336,12 @@ def test_language_name_structure():
pytest.fail(
f'Languages names without expected structure ("LANGUAGE, MODIFIER (SCRIPT)"): {misstructured_language_names}'
)


@pytest.mark.parametrize("lang_code", LANGUAGES)
def test_id_well_formed(lang_code):
if lang_code in ["tw_akuapem_Latn"]:
pytest.xfail("Well we need to have a conversation about that")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. We don't really have a schema for dialects in the same way that we have a schema for regional variants. I need understand from @moyogo why we want Akuapem Twi to be this and not, say, just plain tw_Latn (I think it's the prestige dialect) - particularly since we don't have any other tw_Latns to distinguish this from.

return
lang = LANGUAGES[lang_code]
assert lang.id.startswith(lang.language + "_" + lang.script)