Skip to content
Permalink
Browse files

Use locale guess only if it’s the same language

  • Loading branch information
Kwpolska committed May 24, 2017
1 parent cf812c1 commit 3ee912333139652d3420743c52929f1c83e11778
Showing with 4 additions and 1 deletion.
  1. +4 −1 nikola/nikola.py
@@ -2822,7 +2822,10 @@ def guess_locale_from_lang_posix(lang):
locale_n = '.'.join(locale.getdefaultlocale())
except (ValueError, TypeError):
pass
if not is_valid_locale(locale_n):
# Use guess only if it’s the same language
if not locale_n.startswith(lang.lower()):
locale_n = ''
if not locale_n or not is_valid_locale(locale_n):
# this works in Travis when locale support set by Travis suggestion
locale_n = str((locale.normalize(lang).split('.')[0]) + '.UTF-8')
if not is_valid_locale(locale_n):

0 comments on commit 3ee9123

Please sign in to comment.