[solved] Can't get localization to work

Finwickle

Living in the Layers
Joined
Oct 29, 2016
Messages
312
Location
Europe
I'm trying to get a simple mod to work and I wanted to do it nicely with localization for its only text label. I've looked at several other mods and tried to copy that, but it just doesn't work and shows the LOC_xxx label instead of the text. Hopefully someone can put me in the right direction.

My modinfo:
XML:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="Fin_HexGridOff" version="1.0" xmlns="ModInfo">
    <Properties>
        <Name>LOC_HEX_GRID_OFF_NAME</Name>
        <Description>LOC_HEX_GRID_OFF_DESCRIPTION</Description>
        <Authors>Finwickle</Authors>
        <Package>Mod</Package>
        <AffectsSavedGames>0</AffectsSavedGames>
    </Properties>
    <Dependencies>
        <Mod id="base-standard" title="LOC_MODULE_BASE_STANDARD_NAME" />
    </Dependencies>
    <ActionCriteria>
        <Criteria id="always">
            <AlwaysMet/>
        </Criteria>
    </ActionCriteria>
    <ActionGroups>
        <ActionGroup id="hex-grid-off-actions" scope="game" criteria="always">
            <Actions>
                <UIScripts>
                    <Item>script/hex-grid-off.js</Item>
                    <Item>ui/mini-map/toggle-border-panel-mini-map.js</Item>
                </UIScripts>
                <UpdateText>
                    <File>text/en_us/UIText.xml</File>
                </UpdateText>
            </Actions>
        </ActionGroup>
    </ActionGroups>
    <LocalizedText>
        <File>text/en_us/ModuleText.xml</File>
    </LocalizedText>
</Mod>

The toggle-border-panel-mini-map.js file:
XML:
/**
 * Based on Trade Lens by BlobRoss: https://forums.civfanatics.com/resources/trade-lens.31886/
 *
 * Huge shoutout (from BlobRoss, and now from me as well) to @realitymeltdown in the official Civ VII Discord for figuring this out.
 */
export class ToggleBorderPanelMiniMapDecorator {
    constructor(val) {
        this.miniMap = val;
    }

    beforeAttach() {
    }

    afterAttach() {
        this.miniMap.createLayerCheckbox("LOC_UI_MINI_MAP_BORDERS", "fxs-culture-borders-layer");
    }

    beforeDetach() { }

    afterDetach() { }

    onAttributeChanged(name, prev, next) { }
}

Controls.decorate('panel-mini-map', (val) => new ToggleBorderPanelMiniMapDecorator(val));

And the UIText.xml file:
XML:
<?xml version="1.0" encoding="utf-8"?>
<Database>
    <EnglishText>
        <Row Tag="LOC_UI_MINI_MAP_BORDERS">
            <Text>Borders</Text>
        </Row>
    </EnglishText>
</Database>

The result:
LOC tag instead of text.png
 
Last edited:
I figured it out:
XML:
                <UpdateText>
                    <File>text/en_us/UIText.xml</File>
                </UpdateText>

should have been:
XML:
                <UpdateText>
                    <Item>text/en_us/UIText.xml</Item>
                </UpdateText>

Mod is released here and will have localization now.
 
Back
Top Bottom