Template:TranslationDef

From Heroes of Might and Magic: Olden Era Official Wiki
Revision as of 00:42, 13 May 2026 by Ketura (talk | contribs) (obelisk-bot: uploading initial Cargo templates)

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):
    • BRportugesept_br
    • czechcs, frenchfr, germande, hungarianhu, italianit, japaneseja, koreanko, polishpl, russianru, spanishes, turkishtr, ukrainianuk
    • zhCNzh_cn, zhTWzh_tw
  • Sparse output: any per-language slot the bot couldn't resolve is omitted. Some entities (e.g. faction-shared magic_desc / might_desc for 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 desc field 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.