INNER CODE UNIT · Python

dump_locales_and_texts

futo-org/android-keyboard · tools/make-keyboard-text-py/src/generate.py:76

def dump_locales_and_texts(texts_by_locale):
    out = ""
    for locale in texts_by_locale.keys():
        out += "        " + json.dumps(locale) + ", " + locale_texts_varname(locale) + ",\n"

    return out[:-2]

def generate_templated_code(names, texts_by_locale):
    out = ""
    with open("src/KeyboardTextsTable.tmpl", "r") as f:
        for line in f:
            if "@NAMES@" in line:
                out += dump_names(names) + "\n"
            elif "@TEXTS@" in line:
                out += dump_texts(texts_by_locale) + "\n"
            elif "@LOCALES_AND_TEXTS@" in line:
                out += dump_locales_and_texts(texts_by_locale) + "\n"
            else:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…