Skip to content

Commit

Permalink
Update locale.py
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl authored Dec 22, 2023
1 parent ab1db04 commit 8906d18
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions ovos_config/locale.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@

try:
import lingua_franca as LF
LF_SUPPORTED = True
except ImportError:
LF = None
LF_SUPPORTED = False

_lang = None
_default_tz = None
Expand Down Expand Up @@ -81,10 +79,8 @@ def set_default_lang(lang):
if LF:
try:
LF.set_default_lang(lang)
LF_SUPPORTED = True # re-enable LF
except:
LF_SUPPORTED = False

pass

def get_config_tz():
code = ovos_config.Configuration()["location"]["timezone"]["code"]
Expand All @@ -104,7 +100,7 @@ def set_default_tz(tz=None):
global _default_tz
tz = tz or get_config_tz() or tzlocal()
_default_tz = tz
if LF_SUPPORTED:
if LF:
# tz added in recently, depends on version
try:
LF.time.set_default_tz(tz)
Expand All @@ -117,23 +113,23 @@ def load_languages(langs):
currently only loads lingua-franca language data, in the future
other hooks may be added if we need to perform this operation globally"""
if LF_SUPPORTED:
if LF:
try:
LF.load_languages(langs)
except:
LF_SUPPORTED = False
pass


def load_language(lang):
""" load and configure lang specific resources across OVOS packages
currently only loads lingua-franca language data, in the future
other hooks may be added if we need to perform this operation globally"""
if LF_SUPPORTED:
if LF:
try:
LF.load_language(lang)
except:
LF_SUPPORTED = False
pass


def get_valid_languages():
Expand Down

0 comments on commit 8906d18

Please sign in to comment.