Template:TranslationDef: Difference between revisions
obelisk-bot: uploading initial Cargo templates |
obelisk-bot: uploading initial Cargo templates |
||
| Line 4: | Line 4: | ||
one row per (entity-type, entity-id) pair, discriminated by <code>type</code>. See D-026. | one row per (entity-type, entity-id) pair, discriminated by <code>type</code>. See D-026. | ||
The bot never extracts <code>TranslationDef</code> rows on their own; each parent entity's emit function appends a <code>{{TranslationDef | type=… | …}}</code> call to its own page, right after the entity's structural row. The | The bot never extracts <code>TranslationDef</code> rows on their own; each parent entity's emit function appends a <code><nowiki>{{TranslationDef | type=… | …}}</nowiki></code> call to its own page, right after the entity's structural row. The | ||
<code>{{TranslationDef}}</code> MediaWiki template's job is to call <code>#cargo_store</code> | <code><nowiki>{{TranslationDef}}</nowiki></code> MediaWiki template's job is to call <code>#cargo_store</code> | ||
on this table. | on this table. | ||
| Line 15: | Line 15: | ||
| desc_sid = String | | desc_sid = String | ||
| pt_br_name = String | | pt_br_name = String | ||
| | | pt_br_description = Wikitext | ||
| cs_name = String | | cs_name = String | ||
| | | cs_description = Wikitext | ||
| fr_name = String | | fr_name = String | ||
| | | fr_description = Wikitext | ||
| de_name = String | | de_name = String | ||
| | | de_description = Wikitext | ||
| hu_name = String | | hu_name = String | ||
| | | hu_description = Wikitext | ||
| it_name = String | | it_name = String | ||
| | | it_description = Wikitext | ||
| ja_name = String | | ja_name = String | ||
| | | ja_description = Wikitext | ||
| ko_name = String | | ko_name = String | ||
| | | ko_description = Wikitext | ||
| pl_name = String | | pl_name = String | ||
| | | pl_description = Wikitext | ||
| ru_name = String | | ru_name = String | ||
| | | ru_description = Wikitext | ||
| es_name = String | | es_name = String | ||
| | | es_description = Wikitext | ||
| tr_name = String | | tr_name = String | ||
| | | tr_description = Wikitext | ||
| uk_name = String | | uk_name = String | ||
| | | uk_description = Wikitext | ||
| zh_cn_name = String | | zh_cn_name = String | ||
| | | zh_cn_description = Wikitext | ||
| zh_tw_name = String | | zh_tw_name = String | ||
| | | zh_tw_description = Wikitext | ||
}} | }} | ||
| Line 55: | Line 55: | ||
<!-- Per-language pairs. Each language gets a name + desc column. --> | <!-- Per-language pairs. Each language gets a name + desc column. --> | ||
| pt_br_name = String | | pt_br_name = String | ||
| | | pt_br_description = Wikitext | ||
| cs_name = String | | cs_name = String | ||
| | | cs_description = Wikitext | ||
| fr_name = String | | fr_name = String | ||
| | | fr_description = Wikitext | ||
| de_name = String | | de_name = String | ||
| | | de_description = Wikitext | ||
| hu_name = String | | hu_name = String | ||
| | | hu_description = Wikitext | ||
| it_name = String | | it_name = String | ||
| | | it_description = Wikitext | ||
| ja_name = String | | ja_name = String | ||
| | | ja_description = Wikitext | ||
| ko_name = String | | ko_name = String | ||
| | | ko_description = Wikitext | ||
| pl_name = String | | pl_name = String | ||
| | | pl_description = Wikitext | ||
| ru_name = String | | ru_name = String | ||
| | | ru_description = Wikitext | ||
| es_name = String | | es_name = String | ||
| | | es_description = Wikitext | ||
| tr_name = String | | tr_name = String | ||
| | | tr_description = Wikitext | ||
| uk_name = String | | uk_name = String | ||
| | | uk_description = Wikitext | ||
| zh_cn_name = String | | zh_cn_name = String | ||
| | | zh_cn_description = Wikitext | ||
| zh_tw_name = String | | zh_tw_name = String | ||
| | | zh_tw_description = Wikitext | ||
}} | }} | ||
</nowiki></pre> | </nowiki></pre> | ||
| Line 114: | Line 114: | ||
== Page layout == | == Page layout == | ||
Translation rows do '''not''' live on their own wiki pages. Each row is emitted as a <code>{{TranslationDef | …}}</code> invocation on the parent entity's data page, immediately after the entity's structural row. The | Translation rows do '''not''' live on their own wiki pages. Each row is emitted as a <code><nowiki>{{TranslationDef | …}}</nowiki></code> invocation on the parent entity's data page, immediately after the entity's structural row. The | ||
<code>(type, target_id)</code> discriminator means Cargo can store many rows in | <code>(type, target_id)</code> discriminator means Cargo can store many rows in | ||
a single table without page-naming collisions. | a single table without page-naming collisions. | ||
| Line 128: | Line 128: | ||
| desc_sid={{{desc_sid|}}} | | desc_sid={{{desc_sid|}}} | ||
| pt_br_name={{{pt_br_name|}}} | | pt_br_name={{{pt_br_name|}}} | ||
| | | pt_br_description={{{pt_br_description|}}} | ||
| cs_name={{{cs_name|}}} | | cs_name={{{cs_name|}}} | ||
| | | cs_description={{{cs_description|}}} | ||
| fr_name={{{fr_name|}}} | | fr_name={{{fr_name|}}} | ||
| | | fr_description={{{fr_description|}}} | ||
| de_name={{{de_name|}}} | | de_name={{{de_name|}}} | ||
| | | de_description={{{de_description|}}} | ||
| hu_name={{{hu_name|}}} | | hu_name={{{hu_name|}}} | ||
| | | hu_description={{{hu_description|}}} | ||
| it_name={{{it_name|}}} | | it_name={{{it_name|}}} | ||
| | | it_description={{{it_description|}}} | ||
| ja_name={{{ja_name|}}} | | ja_name={{{ja_name|}}} | ||
| | | ja_description={{{ja_description|}}} | ||
| ko_name={{{ko_name|}}} | | ko_name={{{ko_name|}}} | ||
| | | ko_description={{{ko_description|}}} | ||
| pl_name={{{pl_name|}}} | | pl_name={{{pl_name|}}} | ||
| | | pl_description={{{pl_description|}}} | ||
| ru_name={{{ru_name|}}} | | ru_name={{{ru_name|}}} | ||
| | | ru_description={{{ru_description|}}} | ||
| es_name={{{es_name|}}} | | es_name={{{es_name|}}} | ||
| | | es_description={{{es_description|}}} | ||
| tr_name={{{tr_name|}}} | | tr_name={{{tr_name|}}} | ||
| | | tr_description={{{tr_description|}}} | ||
| uk_name={{{uk_name|}}} | | uk_name={{{uk_name|}}} | ||
| | | uk_description={{{uk_description|}}} | ||
| zh_cn_name={{{zh_cn_name|}}} | | zh_cn_name={{{zh_cn_name|}}} | ||
| | | zh_cn_description={{{zh_cn_description|}}} | ||
| zh_tw_name={{{zh_tw_name|}}} | | zh_tw_name={{{zh_tw_name|}}} | ||
| | | zh_tw_description={{{zh_tw_description|}}} | ||
}}</includeonly> | }}</includeonly> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 169: | Line 169: | ||
| desc_sid = {{{desc_sid|}}} | | desc_sid = {{{desc_sid|}}} | ||
| pt_br_name = {{{pt_br_name|}}} | | pt_br_name = {{{pt_br_name|}}} | ||
| | | pt_br_description = {{{pt_br_description|}}} | ||
| cs_name = {{{cs_name|}}} | | cs_name = {{{cs_name|}}} | ||
| | | cs_description = {{{cs_description|}}} | ||
| fr_name = {{{fr_name|}}} | | fr_name = {{{fr_name|}}} | ||
| | | fr_description = {{{fr_description|}}} | ||
| de_name = {{{de_name|}}} | | de_name = {{{de_name|}}} | ||
| | | de_description = {{{de_description|}}} | ||
| hu_name = {{{hu_name|}}} | | hu_name = {{{hu_name|}}} | ||
| | | hu_description = {{{hu_description|}}} | ||
| it_name = {{{it_name|}}} | | it_name = {{{it_name|}}} | ||
| | | it_description = {{{it_description|}}} | ||
| ja_name = {{{ja_name|}}} | | ja_name = {{{ja_name|}}} | ||
| | | ja_description = {{{ja_description|}}} | ||
| ko_name = {{{ko_name|}}} | | ko_name = {{{ko_name|}}} | ||
| | | ko_description = {{{ko_description|}}} | ||
| pl_name = {{{pl_name|}}} | | pl_name = {{{pl_name|}}} | ||
| | | pl_description = {{{pl_description|}}} | ||
| ru_name = {{{ru_name|}}} | | ru_name = {{{ru_name|}}} | ||
| | | ru_description = {{{ru_description|}}} | ||
| es_name = {{{es_name|}}} | | es_name = {{{es_name|}}} | ||
| | | es_description = {{{es_description|}}} | ||
| tr_name = {{{tr_name|}}} | | tr_name = {{{tr_name|}}} | ||
| | | tr_description = {{{tr_description|}}} | ||
| uk_name = {{{uk_name|}}} | | uk_name = {{{uk_name|}}} | ||
| | | uk_description = {{{uk_description|}}} | ||
| zh_cn_name = {{{zh_cn_name|}}} | | zh_cn_name = {{{zh_cn_name|}}} | ||
| | | zh_cn_description = {{{zh_cn_description|}}} | ||
| zh_tw_name = {{{zh_tw_name|}}} | | zh_tw_name = {{{zh_tw_name|}}} | ||
| | | zh_tw_description = {{{zh_tw_description|}}} | ||
}}</includeonly> | }}</includeonly> | ||
Revision as of 00:02, 13 May 2026
A single shared table for all per-entity i18n payloads. Replaces the parallel UnitTranslation, FactionTranslation,
AttackPassiveTranslation, … tables we used to ship — same shape,
one row per (entity-type, entity-id) pair, discriminated by type. See D-026.
The bot never extracts TranslationDef rows on their own; each parent entity's emit function appends a {{TranslationDef | type=… | …}} call to its own page, right after the entity's structural row. The
{{TranslationDef}} MediaWiki template's job is to call #cargo_store
on this table.
Schema
This template defines the table "Translation". View table.
{{TranslationDef
| type = String <!-- e.g. unit, faction, hero, hero_class, attack_passive -->
| target_id = String <!-- the parent entity's id (Unit.id, Faction.id, etc.) -->
| name_sid = String
| desc_sid = String
<!-- Per-language pairs. Each language gets a name + desc column. -->
| pt_br_name = String
| pt_br_description = Wikitext
| cs_name = String
| cs_description = Wikitext
| fr_name = String
| fr_description = Wikitext
| de_name = String
| de_description = Wikitext
| hu_name = String
| hu_description = Wikitext
| it_name = String
| it_description = Wikitext
| ja_name = String
| ja_description = Wikitext
| ko_name = String
| ko_description = Wikitext
| pl_name = String
| pl_description = Wikitext
| ru_name = String
| ru_description = Wikitext
| es_name = String
| es_description = Wikitext
| tr_name = String
| tr_description = Wikitext
| uk_name = String
| uk_description = Wikitext
| zh_cn_name = String
| zh_cn_description = Wikitext
| zh_tw_name = String
| zh_tw_description = Wikitext
}}
Field notes
- Primary key is
(type, target_id)as a tuple. Joins from parent entities include the type discriminator: e.g.Unit.id = Translation.target_id WHERE Translation.type='unit'.
*English defaults are not here.** They live on each parent entity's row (Unit.name, Faction.name, HeroClass.name, etc.) so the most common query — "give me the English label for this unit" — needs only a single-table read. Translations are the i18n payload only.
- Language-code mapping (game directory → two-letter code):
BRportugese→pt_brczech→cs,french→fr,german→de,hungarian→hu,italian→it,japanese→ja,korean→ko,polish→pl,russian→ru,spanish→es,turkish→tr,ukrainian→ukzhCN→zh_cn,zhTW→zh_tw
- Sparse output: any per-language slot the bot couldn't resolve is omitted. Some entities (e.g. faction-shared
magic_desc/might_descfor HeroClass) deliberately reuse a single SID across many parents — those parents will all carry the same per-language text on their own Translation row. - The
descfield is Wikitext' because translations may include HTML-bold and HTML-italic tags from the L10n corpus, which the bot's resolver converts to wiki markup (and) before storing.
Entity types currently emitted
type |
Parent entity | target_id |
Emit site |
|---|---|---|---|
unit |
[[../Unit|UnitDef]] |
Unit.id |
emit_unit_page
|
unit_ability |
[[../UnitAbility|UnitAbilityDef]] |
UnitAbility.ability_id (composite) |
emit_unit_page
|
attack_passive |
AttackPassiveDef |
AttackPassive.attack_passive_id |
emit_attack_passive_page
|
faction |
[[../Faction|FactionDef]] |
Faction.id |
emit_faction_page
|
(Hero-side entries: hero, hero_class, hero_specialization,
hero_sub_class — added as those entities come online.)
Page layout
Translation rows do not live on their own wiki pages. Each row is emitted as a {{TranslationDef | …}} invocation on the parent entity's data page, immediately after the entity's structural row. The
(type, target_id) discriminator means Cargo can store many rows in
a single table without page-naming collisions.
Wiki template notes
<syntaxhighlight lang="mediawiki">
Per-entity i18n payload, shared across all categories. Invoked from each parent entity's data page (Data:Unit/<id>, Data:Faction/<id>, etc.) — there is no Data:Translation/… page namespace.
</syntaxhighlight>


