Re-work language check; add "Automatic" as default language
This commit is contained in:
parent
eecb5e04e4
commit
5122989d70
@ -167,6 +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",
|
||||||
"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",
|
||||||
@ -515,6 +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
|
||||||
"showdurationnotification-label" : u"Предупреждать о несовпадении продолжительности видео",
|
"showdurationnotification-label" : u"Предупреждать о несовпадении продолжительности видео",
|
||||||
"basics-label" : u"Основное",
|
"basics-label" : u"Основное",
|
||||||
"sync-label" : u"Синхронизация",
|
"sync-label" : u"Синхронизация",
|
||||||
@ -821,6 +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?)
|
||||||
"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",
|
||||||
@ -1007,6 +1010,9 @@ def getInitialLanguage():
|
|||||||
initialLanguage = constants.FALLBACK_INITIAL_LANGUAGE
|
initialLanguage = constants.FALLBACK_INITIAL_LANGUAGE
|
||||||
return initialLanguage
|
return initialLanguage
|
||||||
|
|
||||||
|
def isValidLanguage(language):
|
||||||
|
return messages.has_key(language)
|
||||||
|
|
||||||
def getMessage(type_, locale=None):
|
def getMessage(type_, locale=None):
|
||||||
if constants.SHOW_BUTTON_LABELS == False:
|
if constants.SHOW_BUTTON_LABELS == False:
|
||||||
if "-guibuttonlabel" in type_:
|
if "-guibuttonlabel" in type_:
|
||||||
@ -1015,7 +1021,7 @@ def getMessage(type_, locale=None):
|
|||||||
if "-tooltip" in type_:
|
if "-tooltip" in type_:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
if not messages.has_key(messages["CURRENT"]):
|
if not isValidLanguage(messages["CURRENT"]):
|
||||||
setLanguage(getInitialLanguage())
|
setLanguage(getInitialLanguage())
|
||||||
|
|
||||||
lang = messages["CURRENT"]
|
lang = messages["CURRENT"]
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import argparse
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from syncplay import constants, utils, version, milestone
|
from syncplay import constants, utils, version, milestone
|
||||||
from syncplay.messages import getMessage, setLanguage
|
from syncplay.messages import getMessage, setLanguage, isValidLanguage
|
||||||
from syncplay.players.playerFactory import PlayerFactory
|
from syncplay.players.playerFactory import PlayerFactory
|
||||||
import codecs
|
import codecs
|
||||||
try:
|
try:
|
||||||
@ -116,6 +116,9 @@ class ConfigurationGetter(object):
|
|||||||
self._config['language'] = language
|
self._config['language'] = language
|
||||||
raise InvalidConfigValue("*"+getMessage("config-cleared-notification"))
|
raise InvalidConfigValue("*"+getMessage("config-cleared-notification"))
|
||||||
|
|
||||||
|
if not isValidLanguage(self._config['language']):
|
||||||
|
self._config['language'] = ""
|
||||||
|
|
||||||
def _isPortValid(varToTest):
|
def _isPortValid(varToTest):
|
||||||
try:
|
try:
|
||||||
if varToTest == "" or varToTest is None:
|
if varToTest == "" or varToTest is None:
|
||||||
|
|||||||
@ -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, getInitialLanguage
|
from syncplay.messages import getMessage, getLanguages, setLanguage, isValidLanguage
|
||||||
from syncplay import constants
|
from syncplay import constants
|
||||||
|
|
||||||
class GuiConfiguration:
|
class GuiConfiguration:
|
||||||
@ -629,9 +629,9 @@ 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.languages = getLanguages()
|
self.languages = getLanguages()
|
||||||
if self.languages.has_key(self.config['language']) == False:
|
|
||||||
self.config['language'] = getInitialLanguage()
|
|
||||||
for lang in self.languages:
|
for lang in self.languages:
|
||||||
self.languageCombobox.addItem(self.languages[lang], lang)
|
self.languageCombobox.addItem(self.languages[lang], lang)
|
||||||
if lang == self.config['language']:
|
if lang == self.config['language']:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user