Localization

From Age of Empires 4 Modding
Revision as of 21:44, 19 April 2022 by NawTora (talk | contribs) (Created page with "Category:UI Category:Scripting Localization with multiple script files and UI localization. Simple mods should have no problem with using localization string ID directly: <code>my_string = "$MOD_ID:LOC_STR_ID"</code> Through once mod grows larger (multiple files) it might no longer work as expected. In that case you can use <code>my_string = Loc_FormatText("$MOD_ID:LOC_STR_ID")</code> For localizing xaml UI you will have to use DataContext to hold text and...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Localization with multiple script files and UI localization.

Simple mods should have no problem with using localization string ID directly:

my_string = "$MOD_ID:LOC_STR_ID"

Through once mod grows larger (multiple files) it might no longer work as expected. In that case you can use

my_string = Loc_FormatText("$MOD_ID:LOC_STR_ID")


For localizing xaml UI you will have to use DataContext to hold text and format it.

_mod.data_context.localizedHeader = Loc_FormatText("$MOD_ID:LOC_STR_ID")

<TextBlock Text="{Binding [localizedHeader] }" />