def getText(key, values=(), default=None, replaceFontTags=True): """ Looks up a translated message in XML with a tuple of replacement parameters. It is safe to pass in a single value instead of tuple/list. If the key isn't found, the default is returned. """ if values is None: values = () elif not isinstance(values, (tuple, list)): values = (values, ) if isinstance(key, unicode): warn("getText - received Unicode key %s", key) key = str(key) text = localText.getText(key, values) if (text and text != key): if replaceFontTags: import FontUtil text = FontUtil.replaceSymbols(text) return text else: if default is not None: return default else: debug("BugUtil.getText - XML key %s not found", key) return "XML key %s not found" % key
def getText(key, values=(), default=None, replaceFontTags=True): """ Looks up a translated message in XML with a tuple of replacement parameters. It is safe to pass in a single value instead of tuple/list. If the key isn't found, the default is returned. """ if values is None: values = () elif not isinstance(values, (tuple, list)): values = (values,) if isinstance(key, unicode): warn("getText - received Unicode key %s", key) key = str(key) text = localText.getText(key, values) if (text and text != key): if replaceFontTags: import FontUtil text = FontUtil.replaceSymbols(text) return text else: if default is not None: return default else: debug("BugUtil.getText - XML key %s not found", key) return "XML key %s not found" % key