Language codes for Hebrew (#93681)
* Language codes for Hebrew There is 2 optional code for Hebrew: he-IL is the new code iw-IL is the old code , the google cloud STT for example is using the old code (iw) * Update language.py * Update test_language.py * Update test_language.py * Update test_language.py * Simplify duplicate language check --------- Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
bfec3d68dd
commit
4a3f341444
2 changed files with 45 additions and 3 deletions
|
@ -226,3 +226,39 @@ def test_no_nb_prefer_exact_regions() -> None:
|
|||
"no-AA",
|
||||
["en-US", "en-GB", "no-AA", "nb-AA"],
|
||||
) == ["no-AA", "nb-AA"]
|
||||
|
||||
|
||||
def test_he_iw_same() -> None:
|
||||
"""Test that the he/iw are interchangeable."""
|
||||
assert language.matches(
|
||||
"he",
|
||||
["en-US", "en-GB", "iw"],
|
||||
) == ["iw"]
|
||||
assert language.matches(
|
||||
"iw",
|
||||
["en-US", "en-GB", "he"],
|
||||
) == ["he"]
|
||||
|
||||
|
||||
def test_he_iw_prefer_exact() -> None:
|
||||
"""Test that the exact language is preferred even if an interchangeable language is available."""
|
||||
assert language.matches(
|
||||
"he",
|
||||
["en-US", "en-GB", "iw", "he"],
|
||||
) == ["he", "iw"]
|
||||
assert language.matches(
|
||||
"he",
|
||||
["en-US", "en-GB", "he", "iw"],
|
||||
) == ["he", "iw"]
|
||||
|
||||
|
||||
def test_he_iw_prefer_exact_regions() -> None:
|
||||
"""Test that the exact language/region is preferred."""
|
||||
assert language.matches(
|
||||
"he-IL",
|
||||
["en-US", "en-GB", "iw-IL", "he-IL"],
|
||||
) == ["he-IL", "iw-IL"]
|
||||
assert language.matches(
|
||||
"he-IL",
|
||||
["en-US", "en-GB", "he-IL", "iw-IL"],
|
||||
) == ["he-IL", "iw-IL"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue