Open main menu

Customizable localization

Customizable localizations were introduced in patch 1.20. They basically allow to add bracket commands that can be used in localisations to show different text strings dynamically. They can be used everywhere, where it's possible to use default bracket commands as well (e.g. custom tooltips and custom trigger tooltips, decision titles and descriptions, event titles, descriptions and options, etc.).

Contents

Defining a custom bracket commandEdit

Custom bracket commands are defined in a file in ...\customizable_localization.

defined_text = {
    name = GetIfPapalController

    text = {
        localisation_key = string_is_papal_controller
        trigger = {
            is_papal_controller = yes
        }
    }
    text = {
        localisation_key = string_is_not_papal_controller
        trigger = {
            is_papal_controller = no
        }
    }
}

The "name" defines the bracket command that can be used in localisations afterwards. The "text" sections define specific strings that are shown instead of the bracket command in-game, if the triggers are met. The "localisation_key" defines the string that is shown, if the triggers are met. This key needs to be localized, even if it should contain no characters; otherwise the actual key will be displayed.

Attribute "random"Edit

Customizable localization support the use of the attribute "random". If the custom bracket command either uses random = yes or it is left out, the game will randomly choose a string of which the triggers are met, if there are more possible strings than one. This means, when defining a custom bracket command this way, the triggers of the different "text" sections should exclude each other; similar to multiple if sections, when not using the if-else mechanic.

If the custom bracket command uses random = no, the game will always choose the first string of which the triggers are met, even if there are other strings of which the triggers are met. Similar to the if-else mechanic, this is useful, if there are many strings, because the triggers don't need to be copied every time. It maybe is less performance hungry as well, since it probably doesn't check all triggers, but stops after one trigger is fulfilled.

defined_text = {
    name = GetIfPapalController
    random = no

    text = {
        localisation_key = string_is_papal_controller
        trigger = {
            is_papal_controller = yes
        }
    }
    text = {
        localisation_key = string_is_not_papal_controller
        trigger = {
            always = yes
        }
    }
}

Localizing stringsEdit

The strings that are defined in the "text" sections have to be localized in a localisation file. If that is not done, the game will display the string instead. So, if one string is supposed to display nothing at all, it has to be localized as well.

l_english:
 string_is_papal_controller: "Papal Controller"
 string_is_not_papal_controller: "not Papal Controller"

If a string is supposed to display nothing, it can be localized by only using quotation marks:

l_english:
 string_is_papal_controller: ""
 string_is_not_papal_controller: " not"

Use in localisationEdit

Custom bracket commands are used the same way as default bracket commands. Depending on the defined triggers, they support different scopes (e.g. [From.GetIfPapalController], [Root.GetIfPapalController]). If the triggers are checked globally, for example when checking for global flags, dates, years, ages, months etc., they do not require using a scope, similar to some default bracket commands (e.g. [GetYear], [GetMonth]).

For the example given above, this example tooltip would, depending on the situation, display either (Name of the country) is Papal Controller or (Name of the country) is not Papal Controller.

l_english:
 example_tooltip: "[Root.GetName] is [Root.GetIfPapalController]."

For the second example given in the "Localizing strings" section above, it would be used like this:

l_english:
 example_tooltip: "[Root.GetName] is[Root.GetIfPapalController] Papal Controller."


Documentation EffectsTriggersModifiersScopesVariablesLocalisationCustomizable localization
Scripting AdvisorsAgesBookmarksBuildingsCasus belliColonial regionsCountriesCultureDecisionsDefinesDiplomatic actionsDisastersEstatesEventsFactionsGovernmentGreat projectsHistoryIdea groupsInstitutionsMissionsModifiersNation designerPoliciesReligionRebel typesSubject typesTechnologyTrade companiesTrade goodsUnits
Map MapRandom New WorldTrade nodes
Graphics 3D ModelsInterfaceGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumJoroDox mod making toolMod structureTroubleshootingThe Validator
Guides Adding a province