Skip to content

Commit

Permalink
macOS app: get system language from QLocale
Browse files Browse the repository at this point in the history
Fixes: #288
  • Loading branch information
albertosottile committed Apr 26, 2020
1 parent 1daea64 commit 25314cb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions syncplay/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@ def getMissingStrings():


def getInitialLanguage():
import locale
try:
initialLanguage = locale.getdefaultlocale()[0].split("_")[0]
import sys
frozen = getattr(sys, 'frozen', '')
if frozen in 'macosx_app':
from PySide2.QtCore import QLocale
initialLanguage = QLocale.system().uiLanguages()[0].split('-')[0]
else:
import locale
initialLanguage = locale.getdefaultlocale()[0].split("_")[0]
if initialLanguage not in messages:
initialLanguage = constants.FALLBACK_INITIAL_LANGUAGE
except:
Expand Down

0 comments on commit 25314cb

Please sign in to comment.