Incidents.xml - Core overriding

Started by demeggy, October 22, 2016, 10:03:04 AM

Previous topic - Next topic

demeggy

Hey guys and gals,

I'm in the process of rewording some generic incidents ingame, and have been updating the incidents.xml file in the Languages dir, but for some reason, the Core file is overriding my changes.

Is there anything specific that's needed to be done when editing Language dir files that I'm missing? I've managed to get NameBanks to work perfectly so far, so this a bit different and puzzling that it's not picking up as I'd expect.

Thanks, Demeggy

nccvoyager

Quote from: Tynan
How to translate

Core language files are stored in (GameFolder)/Mods/Core/Languages. The original English data is in (GameFolder)/Mods/Core/Languages/en-US.

To translate:

1. Copy the folder /Mods/Core/Languages/en-US to /Mods/Core/Languages/(YourLanguage)
2. In the "Keyed" folder in (YourLanguage), replace all the English text between the XML tags in every file with equivalent translated text.
3. Create a FriendlyName.txt which contains the name of your language in your language (e.g. Italiano not Italian).
4. Create a flag image in PNG format, 128x64 pixels, called LangIcon.png. See other languages for reference.

However, the are actually two kinds of translation in RimWorld: Keyed and DefInjected.

Keyed translations are used by the game with their "key". e.g. the game wants to show the game-over message, so it looks up the string with the key "GameOverMessage" in the currently-selected language and displays that.

DefInjected translations are different. These work by modifying the core "defs" that define every item, faction, storyteller, skill, and so on. They are data that is "injected" directly into the def data that the game runs on. These are translated by creating a DefInjected folder in your language folder. The en-US language folder lacks one of these because all the original def data is in English so no English data needs to be injected. However, you can see examples from other languages like German.

To translate DefInjected stuff, you'll have to look through the various defs in (GameFolder)/Mods/Core/Defs and create translations for each field of each def that you want to change in your language. The format is <defName.fieldName>, where defName is the defName of the def you want to inject into, and fieldName is the name of the field. So, for example, if you want to modify the label of wood, you'd write <Wood.label>Bois</Wood.label>. This would change the label of wood to "Bois".

Be sure to save your translation files with UTF-8 encoding, or special characters won't show up properly in-game. I recommend using Notepad++ to edit the files; it has an option to change the file encoding.

Quote from here.

demeggy

Quote from: nccvoyager on October 22, 2016, 09:08:05 PM
Quote from: Tynan
How to translate

Core language files are stored in (GameFolder)/Mods/Core/Languages. The original English data is in (GameFolder)/Mods/Core/Languages/en-US.

To translate:

1. Copy the folder /Mods/Core/Languages/en-US to /Mods/Core/Languages/(YourLanguage)
2. In the "Keyed" folder in (YourLanguage), replace all the English text between the XML tags in every file with equivalent translated text.
3. Create a FriendlyName.txt which contains the name of your language in your language (e.g. Italiano not Italian).
4. Create a flag image in PNG format, 128x64 pixels, called LangIcon.png. See other languages for reference.

However, the are actually two kinds of translation in RimWorld: Keyed and DefInjected.

Keyed translations are used by the game with their "key". e.g. the game wants to show the game-over message, so it looks up the string with the key "GameOverMessage" in the currently-selected language and displays that.

DefInjected translations are different. These work by modifying the core "defs" that define every item, faction, storyteller, skill, and so on. They are data that is "injected" directly into the def data that the game runs on. These are translated by creating a DefInjected folder in your language folder. The en-US language folder lacks one of these because all the original def data is in English so no English data needs to be injected. However, you can see examples from other languages like German.

To translate DefInjected stuff, you'll have to look through the various defs in (GameFolder)/Mods/Core/Defs and create translations for each field of each def that you want to change in your language. The format is <defName.fieldName>, where defName is the defName of the def you want to inject into, and fieldName is the name of the field. So, for example, if you want to modify the label of wood, you'd write <Wood.label>Bois</Wood.label>. This would change the label of wood to "Bois".

Be sure to save your translation files with UTF-8 encoding, or special characters won't show up properly in-game. I recommend using Notepad++ to edit the files; it has an option to change the file encoding.

Quote from here.

Fantastic! Thanks for that, I'll go over the files now and check in accordance with the above. I religiously use Notepad++ for all my coding work anyway, so that's a happy coincidence :) Will let you know the outcome, thanks again!

demeggy

Alas, I don't seem to be able to get it running still...

Example:

I've reworded the Alphabeaver incident. I've not altered the defName, or it's point of ref; simply the wording of the actual messagebox that pops up.

My File Structure is: RimWorld\Mods\SWRW\Languages\English\Keyed\Incidents.xml

Yet it still seems to be inheriting the Core files version of events. I'm missing the blatantly obvious, it's a just a case of what that blatantly obvious is! Haha,

Demeggy

nccvoyager

In RimWorld, you are selecting your custom language translation as the language, right?
Just checking... :P

demeggy

Quote from: nccvoyager on October 23, 2016, 08:34:28 PM
In RimWorld, you are selecting your custom language translation as the language, right?
Just checking... :P

Ahem... Yeah... well - well - cough!

"Taxi!"  ;D

Don't I feel rather ridiculous? Thanks! So... if I want the current incidents to have a reworded structure, I have to ensure the players of my mod switch to the unique Language pack? Or am I doing this a pretty hamfisted way?

nccvoyager

Heh, no problem.
(At one point, I spent a day trying to figure out why the mod I was debugging wasn't being loaded before I realized I hadn't actually selected it in the mod list.)

Yeah, it's an actual language translation pack you are making, and players would have to switch to it in order to see changes to core game definition translations you have made.

If this is a modification for a specific mod, there may be another method to modifying the incidents text.
(I'm not sure myself; haven't done much modding in RimWorld, and I'm just coming back to coding in general after a several-years hiatus.)

If this is a translation to another language, including updating an existing translation with some grammatical improvements, or readability improvements, then I would suggest that you take a look at this forum thread.
Tynan left instructions there as to how to become a translation provider on github.

demeggy

Ah, no, it's very much a rewording of incidents triggered within game. I've reworked the Orbital Trader function to state that a ship has landed, rather than orbits, for trade - and the simple reword is all that was needed to clarify this.

Thanks!

nccvoyager

No problem; glad I could render some help. :)