Translation Schema

From XMBdocs
Revision as of 18:44, 26 December 2017 by Miqrogroove (Talk | contribs) (Created page with "A new table named `lang_base` stores a simple list of the names of translation files that have been installed into the board. A new table named `lang_keys` stores a simple li...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A new table named `lang_base` stores a simple list of the names of translation files that have been installed into the board.

A new table named `lang_keys` stores a simple list of the $lang array associative keys that have been used throughout the translation system.

At the core of the new XMB translation system is a typical junction table called `lang_text`. This stores a many-to-many relationship for the primary keys of records in both the `lang_base` and `lang_keys` tables. In addition, there is a BLOB column named `cdata` that stores the translated phrases. Using these three columns, it is possible to select a translation based on the phrase key, the language key, or both as desired.

lang_base.langid is an UNSIGNED TINYINT column. Values are assigned by auto_increment.

lang_base.devname is a VARCHAR(20) column. Values in this column are identical to the filenames that were used in the PHP storage system and in the members.langfile column. This gives developers a single name by which to refer to a translation. For example, a translation previously named French.lang.php will have a single record in this table with "French" as the value in this column. Note these values are not derived from imported file names in the new system. These come from a required value in the new .lang.php format called $devname.

Also note these are intended to be the only two columns ever needed in the lang_base table. All of the translation meta data should be stored with unique keys inside the translation itself. This adds a great deal of flexibility by design. It will never be necessary to modify the lang_base table schema just to add new meta data.

lang_keys.phraseid is an UNSIGNED SMALLINT column. Values are assigned by auto_increment.

lang_keys.langkey is a VARCHAR(30) column. Values in this column are identical to the $lang array keys.

lang_text.langid is an UNSIGN TINYINT column. Values in this column have a many-to-one relationship with lang_base.langid.

lang_text.phraseid is an UNSIGNED SMALLINT column. Values in this column have a many-to-one relationship with lang_keys.phraseid.

lang_text.cdata is a BLOB column. Values in this column are typically used by XMB for raw cdata output (HTML is always allowed). Alternatively, values are sometimes formatted as templates that will be executed by PHP using eval(). Templates should always relate to a key with "eval" in its name.

members.langfile is a VARCHAR(40) column. Values in this column have a many-to-one relationship with lang_base.devname. This stores the language setting for each board member.

settings.langfile is a VARCHAR(34) column. This stores the default language setting for the board.