MCPcopy Create free account
hub / github.com/Syncplay/syncplay / getMessage

Function getMessage

syncplay/messages.py:102–122  ·  view source on GitHub ↗
(type_, locale=None)

Source from the content-addressed store, hash-verified

100
101
102def getMessage(type_, locale=None):
103 if constants.SHOW_TOOLTIPS == False:
104 if "-tooltip" in type_:
105 return ""
106
107 if not isValidLanguage(messages["CURRENT"]):
108 setLanguage(getInitialLanguage())
109
110 lang = messages["CURRENT"]
111 if locale and locale in messages:
112 if type_ in messages[locale]:
113 return str(messages[locale][type_])
114 if lang and lang in messages:
115 if type_ in messages[lang]:
116 return str(messages[lang][type_])
117 if type_ in messages["en"]:
118 return str(messages["en"][type_])
119 else:
120 print("WARNING: Cannot find message '{}'!".format(type_))
121 #return "!{}".format(type_) # TODO: Remove
122 raise KeyError(type_)
123
124def populateLanguageArgument():
125 languageTags = "/".join(getLanguageTags())

Callers 15

getLangTagFromNLFFunction · 0.90
buildPy2exe.pyFile · 0.90
stopRetryingMethod · 0.90
__init__Method · 0.90
checkIfConnectedMethod · 0.90
_toggleReadyMethod · 0.90
_serverUnpausedMethod · 0.90
_serverPausedMethod · 0.90
_serverSeekedMethod · 0.90

Calls 3

isValidLanguageFunction · 0.85
setLanguageFunction · 0.85
getInitialLanguageFunction · 0.85

Tested by

no test coverage detected