Skip to content

Commit

Permalink
fix(validate_locale_configuration): "i18n.json" may not be available …
Browse files Browse the repository at this point in the history
…under test
  • Loading branch information
cfm committed Feb 20, 2025
1 parent d8a8715 commit ac79d45
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions securedrop/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ def validate_locale_configuration(config: SecureDropConfig, babel: Babel) -> Set
available.add(Locale.parse(FALLBACK_LOCALE))

# These locales are supported in the current version of securedrop-app-code.
with open(I18N_CONF) as i18n_conf_file:
i18n_conf = json.load(i18n_conf_file)
supported = parse_locale_set(i18n_conf["supported_locales"].keys())
try:
with open(I18N_CONF) as i18n_conf_file:
i18n_conf = json.load(i18n_conf_file)
supported = parse_locale_set(i18n_conf["supported_locales"].keys())
except FileNotFoundError:
supported = available

# These locales were configured via "securedrop-admin sdconfig", meaning
# they were present on the Admin Workstation at "securedrop-admin" runtime.
Expand Down

0 comments on commit ac79d45

Please sign in to comment.