Exemple #1
0
def report(msg):
    if show_debug_messages:
        vh.classmc('Release BOT: ' + msg, 10, 10)
# Replace this with your script's unique table name:
translation_db_table = "translation_example_py_strings"

# Replace this with path to your script's translation strings file:
translation_file = vh.basedir + "/scripts/my_translations.txt"


# This would only prepare the English strings for use with _[text]:
# _ = update_translation_strings(english_strings)

# This loads the default strings from the database in whatever language is stored there:
_ = update_translation_strings(english_strings, db_table=translation_db_table)

# This will print in English or the language in the database if the table already existed:
vh.classmc(_("Script %s is ready.") % my_name, 3, 10)


def OnOperatorCommand(nick, data):
    global _   # has to be global, because we assign it here

    if data[1:].startswith("tr_example "):
        lang = data[1 + len("tr_example "):]

        if lang == "en":
            # Reset translations to default English:
            _ = update_translation_strings(english_strings)
            vh.usermc(_("OK, English now!"), nick)

        elif lang == "de":
            # Load German from our local dictionary, but copy it first so it is not overwritten.
def UnLoad():
    vh.classmc(_("I'm shutting down..."), 3, 10)
def report(msg):
    if show_debug_messages:
        vh.classmc('Release BOT: '+msg,10,10)