Introduce way to dynamically map the languages, helps reduce the typing and also should "just work" if there's any new languages added

This commit is contained in:
blitzmann
2020-06-25 00:09:36 -04:00
parent a2f65e9d46
commit 8be4b0dd91
3 changed files with 13 additions and 7 deletions

View File

@@ -19,7 +19,12 @@ lang = ""
# Maps supported langauges to their suffix in the database
translation_mapping = {
"en_US": "",
"zh_CN": "_zh"
"fr": "_fr",
"it": "_it",
"ja": "_ja",
"ko": "_ko",
"ru": "_ru",
"zh_CN": "_zh",
}
def set_lang(i18n_lang):

View File

@@ -26,8 +26,7 @@ import eos.config
categories_table = Table("invcategories", gamedata_meta,
Column("categoryID", Integer, primary_key=True),
Column("name", String),
Column("name_zh", String),
*[Column("name{}".format(lang), String) for lang in eos.config.translation_mapping.values()],
Column("description", String), # deprecated
Column("published", Boolean),
Column("iconID", Integer))