1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Localization by replacing English (do not use this for regular mods)

Discussion in 'Civ6 - Modding Tutorials & Reference' started by Merri, Oct 23, 2016.

  1. Merri

    Merri Chieftain

    Joined:
    Aug 18, 2007
    Messages:
    226
    This is the minimum that I needed to do to create a mod that makes changes to the localization database.

    C:\Users\YOURNAME\Documents\My Games\Sid Meier's Civilization VI\Mods\Civilization VI suomeksi\Civilization VI suomeksi.modinfo
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <Mod id="8ed00bf3-99f6-4360-81bf-709791a90fbf" version="1">
        <Properties>
            <Name>LOC_MOD_TITLE</Name>
            <Teaser>LOC_MOD_TEASER</Teaser>
            <Description>LOC_MOD_DESCRIPTION</Description>
            <Authors>LOC_MOD_AUTHORS</Authors>
            <EnabledByDefault>1</EnabledByDefault>
        </Properties>
        <Components>
            <LocalizedText id="FINNISH_TEXT">
                <Items>
                    <File>Translations/Vanilla_fi_FI.xml</File>
                </Items>
            </LocalizedText>
        </Components>
        <LocalizedText>
            <Text id="LOC_MOD_TITLE">
                <en_US>Civilization VI suomeksi</en_US>
            </Text>
            <Text id="LOC_MOD_TEASER">
                <en_US>Finnish Language Pack</en_US>
            </Text>
            <Text id="LOC_DESCRIPTION">
                <en_US>This language pack providers the glorious Finnish language to the game.</en_US>
            </Text>
            <Text id="LOC_MOD_AUTHORS">
                <en_US>Vesa Piittinen</en_US>
            </Text>
        </LocalizedText>
        <Files>
            <File>Translations/Vanilla_fi_FI.xml</File>
        </Files>
    </Mod>
    ./Translations/Vanilla_fi_FI.xml
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <GameData>
        <LocalizedText>
            <Update>
                <Where Tag="LOC_UNITOPERATION_FOUND_CITY_DESCRIPTION" Language="en_US" />
                <Set Text="Perusta kaupunki" />
            </Update>
        </LocalizedText>
    </GameData>
    Please DO NOT use <Update /> like this with regular mods to replace original string tags, instead make your own tags. If you reuse original tags for your own purposes you will mess up any localization done, probably ending up in a situatation where localization displays things like the original unit name translated instead of your unit name. By using new tags the correct strings will appear despite there being no localized string and there will be no conflicts.

    Also, I would prefer to not doing things this way and instead add a new fi_FI language, but this method will suffice until there are better options available - if there ever will be. Civilization V was quite painful to work with, especially with expansions and their reuse of original tags... was impossible to make a language pack that required no hassle from end user if they didn't happen to have all the latest stuff.
     
    camomilk likes this.
  2. Merri

    Merri Chieftain

    Joined:
    Aug 18, 2007
    Messages:
    226
    You can also use <Replace /> instead of <Update />:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <GameData>
        <LocalizedText>
            <Replace Tag="LOC_UNITOPERATION_FOUND_CITY_DESCRIPTION" Language="en_US">
                <Text>Perusta kaupunki</Text>
            </Replace>
        </LocalizedText>
    </GameData>
    This is a much more convenient format for grid type viewing of XML files.
     
  3. Xaviarlol

    Xaviarlol Chieftain

    Joined:
    May 27, 2011
    Messages:
    205
    I've been having some issues with texts in my mod. I am trying to change some texts (such as policies for example) to match the changes in the mod. I've simply used the update string and modified the text. This seems to work fine until I reload a game in the same session in which the texts revert back to vanilla. Relaunching the application fixes the issue, until you reload again once in game. Any ideas as to why it's behaving this way?
     
  4. Merri

    Merri Chieftain

    Joined:
    Aug 18, 2007
    Messages:
    226
    It is a bug in the game engine. When reloading a game the localization database is cleared, but it isn't properly refreshed again when loading game a second time like on the first load. The second load appears to always use the backed up localization database with no modifications applied on it instead of the modded one (Aztec DLC probably works because it's strings are not added via modinfo, which is why Firaxis devs haven't caught this one).

    Also, when quitting a localized game I can get stuff like the main menu localized, so I'm seeing modifications made by a Mod in a state where a Mod shouldn't be active. The problem clears up after viewing something like options, thus the strings are read at the wrong time. But still, this is another bug related to localization. I hope these things get fixed.

    Of course in case of a language pack I would like to have my Mod have effect right away on startup and staying consistent all the time, thus having main menu translated when game boots up and not only after starting a game.


    However, as for your case, I recommend you add a new string instead of changing an old one. It is probably more work, but from technical perspective it is "the right thing" to do.
     
  5. IllustriousYou

    IllustriousYou Chieftain

    Joined:
    Oct 25, 2016
    Messages:
    29
    Location:
    Earth
    Do you have any tips for modding the civilopedia? The names of many pages are calculated. If, for example, I want to replace the text on the intro screen, is the replace/update my only option that doesn't involve rewriting the screen?
     
  6. Merri

    Merri Chieftain

    Joined:
    Aug 18, 2007
    Messages:
    226
    My knowledge doesn't go that far as I've only focused in the final localization layer; but it is a shame if it is hard to simply change the actual tags. Especially with the replace/update via Mod reload bug.
     
    IllustriousYou likes this.

Share This Page