Add "Warn About Missing Strings" option

This commit is contained in:
Et0h 2014-11-29 15:27:36 +00:00
parent ef73447753
commit fe02b884da
3 changed files with 16 additions and 1 deletions

View File

@ -6,7 +6,7 @@ from twisted.internet.protocol import ClientFactory
from twisted.internet import reactor, task
from syncplay.protocols import SyncClientProtocol
from syncplay import utils, constants
from syncplay.messages import getMessage
from syncplay.messages import getMessage, getMissingStrings
import threading
from syncplay.constants import PRIVACY_SENDHASHED_MODE, PRIVACY_DONTSEND_MODE, \
PRIVACY_HIDDENFILENAME, FILENAME_STRIP_REGEX
@ -102,6 +102,11 @@ class SyncplayClient(object):
if constants.LIST_RELATIVE_CONFIGS and self._config.has_key('loadedRelativePaths') and self._config['loadedRelativePaths']:
self.ui.showMessage(getMessage("relative-config-notification").format("; ".join(self._config['loadedRelativePaths'])), noPlayer=True, noTimestamp=True)
if constants.DEBUG_MODE and constants.WARN_ABOUT_MISSING_STRINGS:
missingStrings = getMissingStrings()
if missingStrings is not None and missingStrings is not "":
self.ui.showDebugMessage("MISSING STRINGS DETECTED:\n{}".format(missingStrings))
def initProtocol(self, protocol):
self._protocol = protocol

View File

@ -14,6 +14,7 @@ LIST_RELATIVE_CONFIGS = True # Print list of relative configs loaded
SHOW_CONTACT_INFO = True # Displays dev contact details below list in GUI
SHOW_BUTTON_LABELS = True # If disabled, only shows icons for main GUI buttons
SHOW_TOOLTIPS = True
WARN_ABOUT_MISSING_STRINGS = False # (If debug mode is enabled)
#Overriden by config
SHOW_OSD = True # Sends Syncplay messages to media player OSD

View File

@ -783,6 +783,15 @@ messages = {
def setLanguage(lang):
messages["current"] = lang
def getMissingStrings():
missingStrings = ""
for lang in messages:
if lang != "en" and lang != "current":
for message in messages["en"]:
if not messages[lang].has_key(message):
missingStrings = missingStrings + "({}) Missing: {}\n".format(lang, message)
return missingStrings
def getMessage(type_, locale=None):
if constants.SHOW_BUTTON_LABELS == False:
if "-guibuttonlabel" in type_: