diff --git a/neon_core/configuration/neon.yaml b/neon_core/configuration/neon.yaml index 075a3d4ef..3b69d7ebd 100644 --- a/neon_core/configuration/neon.yaml +++ b/neon_core/configuration/neon.yaml @@ -280,6 +280,7 @@ system_unit: metric time_format: half date_format: MDY lang: en-us +secondary_langs: [en-us, uk-ua] location: city: code: Lawrence diff --git a/neon_core/skills/intent_service.py b/neon_core/skills/intent_service.py index ce17e4a55..9e6b2afb1 100644 --- a/neon_core/skills/intent_service.py +++ b/neon_core/skills/intent_service.py @@ -66,6 +66,8 @@ def __init__(self, bus: MessageBusClient): self.converse = NeonConverseService(bus) self.config = Configuration() self.language_config = get_lang_config() + LOG.debug(f"Languages Adapt={self.adapt_service.engines.keys()}|" + f"Padatious={self.padatious_service.containers.keys()}") # Initialize default user to inject into incoming messages try: @@ -154,6 +156,7 @@ def _get_parsers_service_context(self, message: Message, lang: str): """ utterances = message.data.get('utterances', []) message.context["lang"] = lang + LOG.debug(f"lang={lang}|utterances={utterances}") utterances, message.context = \ self.transformers.transform(utterances, message.context) message.data["utterances"] = utterances @@ -172,9 +175,15 @@ def handle_utterance(self, message): self.bus.emit(message.response()) try: + requested_lang = message.data.get('lang') # Get language of the utterance lang = get_full_lang_code( message.data.get('lang') or self.language_config["user"]) + if requested_lang and \ + requested_lang.split('-')[0] != lang.split('-')[0]: + lang = get_full_lang_code(requested_lang.split('-')[0]) + LOG.warning(f"requested={requested_lang}|resolved={lang}") + message.data["lang"] = lang LOG.debug(f"message_lang={lang}") # Add or init timing data diff --git a/requirements/requirements.txt b/requirements/requirements.txt index e4ab71153..131a16bc3 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -23,7 +23,7 @@ mock~=5.0 # default plugins neon-lang-plugin-libretranslate~=0.2 -neon-utterance-translator-plugin~=0.1 +neon-utterance-translator-plugin~=0.1,>=0.1.2a0 neon-utterance-normalizer-plugin~=0.0.2 # TODO: Patching test failures https://github.com/NeonGeckoCom/NeonCore/actions/runs/4888865255/jobs/8727164992?pr=422 diff --git a/requirements/skills_essential.txt b/requirements/skills_essential.txt index 7501e41c3..1ad905425 100644 --- a/requirements/skills_essential.txt +++ b/requirements/skills_essential.txt @@ -1,5 +1,5 @@ neon-skill-about~=1.0 neon-skill-date_time~=1.0,>=1.0.1a2 neon-skill-demo~=1.0,>=1.0.1a1 -neon-skill-device_controls~=1.0 -neon-skill-ip_address~=1.0 +neon-skill-device_controls~=1.0,>=1.0.1a2 +neon-skill-ip_address~=1.0,>=1.0.1a3