INNER CODE UNIT · Python
generate_templated_code
futo-org/android-keyboard · tools/make-keyboard-text-py/src/generate.py:83
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:
out += line
return out
def dedup(t):
return list(dict.fromkeys(t))
if __name__ == "__main__":