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
|
@ -10,6 +10,14 @@ import re
|
|||
from homeassistant.const import MATCH_ALL
|
||||
|
||||
SEPARATOR_RE = re.compile(r"[-_]")
|
||||
SAME_LANGUAGES = (
|
||||
# no = spoken Norwegian
|
||||
# nb = written Norwegian (Bokmål)
|
||||
("nb", "no"),
|
||||
# he = Hebrew new code
|
||||
# iw = Hebrew old code
|
||||
("he", "iw"),
|
||||
)
|
||||
|
||||
|
||||
def preferred_regions(
|
||||
|
@ -60,9 +68,7 @@ def is_language_match(lang_1: str, lang_2: str) -> bool:
|
|||
# Exact match
|
||||
return True
|
||||
|
||||
if {lang_1, lang_2} == {"no", "nb"}:
|
||||
# no = spoken Norwegian
|
||||
# nb = written Norwegian (Bokmål)
|
||||
if tuple(sorted([lang_1, lang_2])) in SAME_LANGUAGES:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue