Skip to content

Commit

Permalink
fix/2-letter-langcode-handling
Browse files Browse the repository at this point in the history
companion to OpenVoiceOS/ovos-config#85

fixes #380
  • Loading branch information
JarbasAl authored Dec 7, 2023
1 parent 8cb8f25 commit d99f554
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ovos_core/intent_services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from collections import namedtuple

from ovos_config.config import Configuration
from ovos_config.locale import setup_locale
from ovos_config.locale import setup_locale, get_valid_languages, get_full_lang_code

from ovos_bus_client.message import Message
from ovos_bus_client.session import SessionManager
Expand Down Expand Up @@ -181,13 +181,13 @@ def disambiguate_lang(message):
4 - config lang (or from message.data)
"""
default_lang = get_message_lang(message)
valid_langs = [default_lang] + Configuration().get("secondary_langs", [])
valid_langs = get_valid_languages()
lang_keys = ["stt_lang",
"request_lang",
"detected_lang"]
for k in lang_keys:
if k in message.context:
v = message.context[k]
v = get_full_lang_code(message.context[k])
if v in valid_langs:
if v != default_lang:
LOG.info(f"replaced {default_lang} with {k}: {v}")
Expand Down

0 comments on commit d99f554

Please sign in to comment.