Ladsgroup has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/203896

Change subject: Revert "Revert "set default userinterface_lang in config""
......................................................................

Revert "Revert "set default userinterface_lang in config""

This reverts commit a0a416b5a159a411a504caac2f8c504f5fa2790b.

Change-Id: Ie89ebdd2c4d518d735d5794e0b070558783df066
---
M pywikibot/config2.py
M pywikibot/i18n.py
2 files changed, 7 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/96/203896/1

diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index dbb1c28..60e6740 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -29,6 +29,7 @@
 import stat
 import sys
 
+from locale import getdefaultlocale
 from warnings import warn
 
 from pywikibot.tools import default_encoding
@@ -909,6 +910,9 @@
 # Fix up default console_encoding
 console_encoding = default_encoding(console_encoding)
 
+if userinterface_lang is None:
+    userinterface_lang = getdefaultlocale()[0].split('_')[0]
+
 # Fix up transliteration_target
 if transliteration_target == 'not set':
     if sys.platform == 'win32':
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index 2fff519..4d19b4f 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -28,7 +28,6 @@
 
 import sys
 import re
-import locale
 import warnings
 
 from pywikibot import Error
@@ -617,9 +616,8 @@
     """
     Ask the user a question, return the user's answer.
 
-    The prompt message is retrieved via L{twtranslate} and either uses the
-    config variable 'userinterface_lang' or the default locale as the language
-    code.
+    The prompt message is retrieved via L{twtranslate} and uses the
+    config variable 'userinterface_lang'.
 
     @param twtitle: The TranslateWiki string title, in <package>-<key> format
     @param parameters: The values which will be applied to the translated text
@@ -635,8 +633,7 @@
         else:
             prompt = fallback_prompt
     else:
-        code = config.userinterface_lang or \
-            locale.getdefaultlocale()[0].split('_')[0]
+        code = config.userinterface_lang
 
         prompt = twtranslate(code, twtitle, parameters)
     return pywikibot.input(prompt, password)

-- 
To view, visit https://gerrit.wikimedia.org/r/203896
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie89ebdd2c4d518d735d5794e0b070558783df066
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to