mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
getdefaultlocale() can fail
This commit is contained in:
parent
08a0bfccbe
commit
18d671c3a3
1 changed files with 5 additions and 1 deletions
|
@ -248,7 +248,11 @@ create table if not exists profiles
|
|||
d.connect(d, SIGNAL("accepted()"), self._onLangSelected)
|
||||
d.connect(d, SIGNAL("rejected()"), lambda: True)
|
||||
# default to the system language
|
||||
try:
|
||||
(lang, enc) = locale.getdefaultlocale()
|
||||
except:
|
||||
# fails on osx
|
||||
lang = "en"
|
||||
if lang and lang not in ("pt_BR", "zh_CN", "zh_TW"):
|
||||
lang = re.sub("(.*)_.*", "\\1", lang)
|
||||
# find index
|
||||
|
|
Loading…
Reference in a new issue