Skip to content

Commit

Permalink
Merge pull request #129 from OpenVoiceOS/release-0.1.4a1
Browse files Browse the repository at this point in the history
Release 0.1.4a1
  • Loading branch information
JarbasAl authored Oct 16, 2024
2 parents 97af86e + 8d1dc75 commit f21044b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 23 deletions.
14 changes: 3 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
# Changelog

## [0.1.3a1](https://github.com/OpenVoiceOS/ovos-bus-client/tree/0.1.3a1) (2024-10-15)
## [0.1.4a1](https://github.com/OpenVoiceOS/ovos-bus-client/tree/0.1.4a1) (2024-10-16)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-bus-client/compare/0.1.2a1...0.1.3a1)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-bus-client/compare/0.1.3...0.1.4a1)

**Merged pull requests:**

- fix:allow newer pyee [\#124](https://github.com/OpenVoiceOS/ovos-bus-client/pull/124) ([JarbasAl](https://github.com/JarbasAl))

## [0.1.2a1](https://github.com/OpenVoiceOS/ovos-bus-client/tree/0.1.2a1) (2024-10-15)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-bus-client/compare/0.1.1...0.1.2a1)

**Merged pull requests:**

- port/tests\_from\_core [\#125](https://github.com/OpenVoiceOS/ovos-bus-client/pull/125) ([JarbasAl](https://github.com/JarbasAl))
- fix:standardize\_lang [\#128](https://github.com/OpenVoiceOS/ovos-bus-client/pull/128) ([JarbasAl](https://github.com/JarbasAl))



Expand Down
4 changes: 2 additions & 2 deletions ovos_bus_client/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ovos_config.config import Configuration
from ovos_config.locale import get_default_lang
from ovos_utils.log import LOG, log_deprecation

from ovos_utils.lang import standardize_lang_tag
from ovos_bus_client.message import dig_for_message, Message


Expand Down Expand Up @@ -297,7 +297,7 @@ def __init__(self, session_id: str = None,
Configuration().get("skills", {}).get("blacklisted_skills", []))
self.blacklisted_intents = (blacklisted_intents or
Configuration().get("intents", {}).get("blacklisted_intents", []))
self.lang = lang or get_default_lang()
self.lang = standardize_lang_tag(lang or get_default_lang())
self.system_unit = system_unit or Configuration().get("system_unit", "metric")
self.date_format = date_format or Configuration().get("date_format", "DMY")
self.time_format = time_format or Configuration().get("time_format", "full")
Expand Down
5 changes: 3 additions & 2 deletions ovos_bus_client/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from ovos_config.config import read_mycroft_config
from ovos_config.locale import get_default_lang
from ovos_utils.json_helper import merge_dict
from ovos_utils.lang import standardize_lang_tag
from ovos_bus_client import MessageBusClient
from ovos_bus_client.message import dig_for_message, Message
from ovos_bus_client.session import SessionManager
Expand All @@ -39,14 +40,14 @@ def get_message_lang(message=None):
# old style lang param
lang = message.data.get("lang") or message.context.get("lang")
if lang:
return lang
return standardize_lang_tag(lang)

# new style session lang
if "session_id" in message.context or "session" in message.context:
sess = SessionManager.get(message)
return sess.lang

return get_default_lang()
return standardize_lang_tag(get_default_lang())


def get_websocket(host, port, route='/', ssl=False, threaded=True):
Expand Down
4 changes: 2 additions & 2 deletions ovos_bus_client/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# START_VERSION_BLOCK
VERSION_MAJOR = 0
VERSION_MINOR = 1
VERSION_BUILD = 3
VERSION_ALPHA = 0
VERSION_BUILD = 4
VERSION_ALPHA = 1
# END_VERSION_BLOCK
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ovos-config>=0.0.12,<1.0.0
ovos-utils>=0.0.38,<1.0.0
ovos-utils>=0.3.5,<1.0.0
websocket-client>=0.54.0
pyee>=8.1.0, < 12.0.0
orjson
10 changes: 5 additions & 5 deletions test/unittests/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,16 @@ def test_no_lang_in_message(self):
"""No lang in message should result in lang from active locale."""
setup_locale("it-it")
msg = Message('test msg', data={})
self.assertEqual(get_message_lang(msg), 'it-it')
self.assertEqual(get_message_lang(msg), 'it-IT')
setup_locale("en-us")
self.assertEqual(get_message_lang(msg), 'en-us')
self.assertEqual(get_message_lang(msg), 'en-US')

def test_lang_exists(self):
"""Message has a lang code in data, it should be used."""
msg = Message('test msg', data={'lang': 'de-de'})
self.assertEqual(get_message_lang(msg), 'de-de')
msg = Message('test msg', data={'lang': 'sv-se'})
self.assertEqual(get_message_lang(msg), 'sv-se')
self.assertEqual(get_message_lang(msg), 'de-DE')
msg = Message('test msg', data={'lang': 'sv-SE'})
self.assertEqual(get_message_lang(msg), 'sv-SE')


class TestCollectionMessage(unittest.TestCase):
Expand Down

0 comments on commit f21044b

Please sign in to comment.