Skip to content
Permalink
Browse files

Merge branch 'master' into fix-2982-harder

  • Loading branch information
ralsina committed Mar 17, 2018
2 parents a72eb96 + 064d63f commit a5325cb357b870b9f724db6f2c3335791fa5740d
Showing with 24 additions and 22 deletions.
  1. +1 −0 CHANGES.txt
  2. +23 −22 nikola/utils.py
@@ -36,6 +36,7 @@ Bugfixes

* Handle '/' and other absolute paths better in POSTS / PAGES / TRANSLATIONS
(Issue #2982)
* Fix loading non-default languages
* Support KaTeX for reST display math (Issue #2888)
* Use npm for asset management instead of bower, which was deprecated
(Issue #2790)
@@ -705,28 +705,29 @@ def load_messages(themes, translations, default_lang, themes_dirs):
default_folder = os.path.join(get_theme_path_real('base', themes_dirs), 'messages')
sys.path.insert(0, default_folder)
sys.path.insert(0, msg_folder)
english = __import__('messages_en')
# If we don't do the reload, the module is cached
_reload(english)
for lang in list(translations.keys()):
try:
translation = __import__('messages_' + lang)
# If we don't do the reload, the module is cached
_reload(translation)
if sorted(translation.MESSAGES.keys()) !=\
sorted(english.MESSAGES.keys()) and \
lang not in language_incomplete_warned:
language_incomplete_warned.append(lang)
LOGGER.warn("Incomplete translation for language "
"'{0}'.".format(lang))
messages[lang].update(english.MESSAGES)
for k, v in translation.MESSAGES.items():
if v:
messages[lang][k] = v
del(translation)
except ImportError as orig:
raise LanguageNotFoundError(lang, orig)
del(english)

english = __import__('messages_en')
# If we don't do the reload, the module is cached
_reload(english)
for lang in list(translations.keys()):
try:
translation = __import__('messages_' + lang)
# If we don't do the reload, the module is cached
_reload(translation)
if sorted(translation.MESSAGES.keys()) !=\
sorted(english.MESSAGES.keys()) and \
lang not in language_incomplete_warned:
language_incomplete_warned.append(lang)
LOGGER.warn("Incomplete translation for language "
"'{0}'.".format(lang))
messages[lang].update(english.MESSAGES)
for k, v in translation.MESSAGES.items():
if v:
messages[lang][k] = v
del(translation)
except ImportError as orig:
raise LanguageNotFoundError(lang, orig)
del(english)
sys.path = oldpath
return messages

0 comments on commit a5325cb

Please sign in to comment.
You can’t perform that action at this time.