Skip to content

Commit

Permalink
Use locale guess only if it’s the same language
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwpolska committed May 24, 2017
1 parent cf812c1 commit 3ee9123
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nikola/nikola.py
Expand Up @@ -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):
Expand Down

0 comments on commit 3ee9123

Please sign in to comment.