INNER CODE UNIT · Python

dump_texts

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

def dump_texts(texts_by_locale):
    out = ""
    for locale, texts in texts_by_locale.items():
        out += "    private static final String[] " + locale_texts_varname(locale) + " = {\n"
        for item in texts:
            if item == "":
                out += "        EMPTY,\n"
            else:
                out += "        " + json.dumps(item) + ",\n"
        out = out[:-2] + "\n    };\n\n"

    return out

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"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…