Browse Source

Define a constant for the default language

pull/176/head
Louis 9 years ago
parent
commit
251deb889a
  1. 9
      patacrep/latex/__init__.py

9
patacrep/latex/__init__.py

@ -13,6 +13,8 @@ from patacrep.latex.syntax import tex2plain, parse_song
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
DEFAULT_LANGUAGE = "en_us"
BABEL_LANGUAGES = OrderedDict(( BABEL_LANGUAGES = OrderedDict((
('de_de', 'german'), ('de_de', 'german'),
('de_at', 'austrian'), ('de_at', 'austrian'),
@ -132,13 +134,14 @@ def checklanguage(lang):
available = ", ".join(BABEL_LANGUAGES.keys()) available = ", ".join(BABEL_LANGUAGES.keys())
raise UnknownLanguage( raise UnknownLanguage(
original=lang, original=lang,
fallback="en_us", fallback=DEFAULT_LANGUAGE,
message=( message=(
"Unknown language code '{}' (supported: {}). Using " "Unknown language code '{}' (supported: {}). Using "
"default 'en_us' instead." "default '{}' instead."
).format( ).format(
lang, lang,
available available,
DEFAULT_LANGUAGE,
) )
) )

Loading…
Cancel
Save