Specify what the automatic language is & fix initial locale check

This commit is contained in:
Et0h 2014-12-02 21:41:53 +00:00
parent 5122989d70
commit 95d1915d63
2 changed files with 7 additions and 8 deletions

View File

@ -167,7 +167,7 @@ en = {
"showslowdownosd-label" :"Include slowing down / reverting notification", "showslowdownosd-label" :"Include slowing down / reverting notification",
"showcontactinfo-label" : "Show contact info box", "showcontactinfo-label" : "Show contact info box",
"language-label" : "Language", "language-label" : "Language",
"automatic-language" : "Automatic", "automatic-language" : "Automatic ({})", # Automatic language #
"showdurationnotification-label" : "Warn about media duration mismatches", "showdurationnotification-label" : "Warn about media duration mismatches",
"basics-label" : "Basics", "basics-label" : "Basics",
"sync-label" : "Sync", "sync-label" : "Sync",
@ -516,7 +516,7 @@ ru = {
"showslowdownosd-label" : u"Показывать уведомления о замедлении/перемотке", "showslowdownosd-label" : u"Показывать уведомления о замедлении/перемотке",
"showcontactinfo-label" : u"Отображать контактную информацию разработчиков", "showcontactinfo-label" : u"Отображать контактную информацию разработчиков",
"language-label" : u"Language", # TODO: Translate ito Russian "language-label" : u"Language", # TODO: Translate ito Russian
"automatic-language" : "Automatic", # TODO: Translate ito Russian "automatic-language" : "Automatic ({})", # Automatic language # TODO: Translate ito Russian
"showdurationnotification-label" : u"Предупреждать о несовпадении продолжительности видео", "showdurationnotification-label" : u"Предупреждать о несовпадении продолжительности видео",
"basics-label" : u"Основное", "basics-label" : u"Основное",
"sync-label" : u"Синхронизация", "sync-label" : u"Синхронизация",
@ -823,7 +823,7 @@ de = {
"showslowdownosd-label" : u"Zeige Verlangsamungs/Zurücksetzungs-Benachrichtigung", "showslowdownosd-label" : u"Zeige Verlangsamungs/Zurücksetzungs-Benachrichtigung",
"showcontactinfo-label" : u"Zeige Kontaktinformationen", "showcontactinfo-label" : u"Zeige Kontaktinformationen",
"language-label" : u"Sprache", "language-label" : u"Sprache",
"automatic-language" : "Automatic", # TODO: Translate into German (Automatisch?) "automatic-language" : "Automatic ({})", # Automatic language # TODO: Translate into German (Automatisch?)
"showdurationnotification-label" : u"Zeige Warnung wegen unterschiedlicher Dauer", "showdurationnotification-label" : u"Zeige Warnung wegen unterschiedlicher Dauer",
"basics-label" : u"Basics", "basics-label" : u"Basics",
"sync-label" : u"Synchronisation", "sync-label" : u"Synchronisation",
@ -1002,9 +1002,8 @@ def getMissingStrings():
def getInitialLanguage(): def getInitialLanguage():
import locale import locale
try: try:
systemLocale = locale.getdefaultlocale("language")[0] initialLanguage = locale.getdefaultlocale("language")[0].split("_")[0]
initialLanguage = systemLocale.split("_")[0] if not messages.has_key(initialLanguage):
if not messages.has_key(systemLocale):
initialLanguage = constants.FALLBACK_INITIAL_LANGUAGE initialLanguage = constants.FALLBACK_INITIAL_LANGUAGE
except: except:
initialLanguage = constants.FALLBACK_INITIAL_LANGUAGE initialLanguage = constants.FALLBACK_INITIAL_LANGUAGE

View File

@ -5,7 +5,7 @@ from syncplay.players.playerFactory import PlayerFactory
import os import os
import sys import sys
from syncplay.messages import getMessage, getLanguages, setLanguage, isValidLanguage from syncplay.messages import getMessage, getLanguages, setLanguage, getInitialLanguage
from syncplay import constants from syncplay import constants
class GuiConfiguration: class GuiConfiguration:
@ -629,7 +629,7 @@ class ConfigDialog(QtGui.QDialog):
self.languageLabel = QLabel(getMessage("language-label"), self) self.languageLabel = QLabel(getMessage("language-label"), self)
self.languageCombobox = QtGui.QComboBox(self) self.languageCombobox = QtGui.QComboBox(self)
self.languageCombobox.addItem(getMessage("automatic-language")) self.languageCombobox.addItem(getMessage("automatic-language").format(getMessage("LANGUAGE", getInitialLanguage())))
self.languages = getLanguages() self.languages = getLanguages()
for lang in self.languages: for lang in self.languages: