--- title: "Providing translations: Content Patcher's `EditData`" tags: project-fluent --- # Providing translations: Content Patcher's `EditData` :::info All of this information also applies to C#/SMAPI mods, which can use the content API to provide the same information in a similar way. ::: If you are already making a [Content Patcher](https://www.nexusmods.com/stardewvalley/mods/1915) content pack, it may make more sense to utilize Content Patcher's `EditData` action to add translations, instead of creating a separate Project Fluent content pack. This also has the benefit of being able to use all of the Content Patcher's tokens. To add an asset-provided content pack, modify your existing Content Patcher `content.json` and include an `EditData` action, targeting the `Shockah.ProjectFluent/ContentPacks` asset: ```json { // ... "Changes": [ // ... { "Action": "EditData", "Target": "Shockah.ProjectFluent/ContentPacks", "Entries": { "": { // this will always append a new value // `ID` is only used to identify the specific patch // it can be anything "ID": "YourName.YourModName.Somebody.SomeMod.LangCode", // the rest of the content pack model goes here } }, } ] } ``` See [Content Patcher's `EditData` documentation](https://github.com/Pathoschild/StardewMods/blob/develop/ContentPatcher/docs/author-guide/action-editdata.md) for more details on the `EditData` action. ## Example mod This example assumes you are already familiar with creating Content Patcher mods and already have a `content.json` file prepared. If not, see [the Content Patcher documentation](https://github.com/Pathoschild/StardewMods/blob/develop/ContentPatcher/docs/author-guide.md#get-started). In this example we want to translate the Automate mod to the Polish language. The `1.25.3` version of the mod does in fact support translations, and they are i18n-based translations. Because Automate uses i18n-based translations, we will be using the `AdditionalI18nPaths` key. If Automate used Fluent-based translations, we would be using the `AdditionalFluentPaths` key instead. To see more information about those and other keys, see [the Content Pack model page](https://hackmd.io/@Shockah/By3QmzXq5). Modify your Content Patcher `content.json` and add an `EditData` action targeting the `Shockah.ProjectFluent/ContentPacks`: ```json { // ... "Changes": [ // ... { "Action": "EditData", "Target": "Shockah.ProjectFluent/ContentPacks", "Entries": { "": { "ID": "YourName.YourModName.Pathoschild.Automate.PL", "Format": "1.1.0", "AdditionalI18nPaths": [ { "LocalizedMod": "Pathoschild.Automate", "LocalizingMod": "YourName.YourModName" } ] } }, } ] } ``` The `ID` is only used to identify the specific patch, and its value does not matter, but a good practice is to combine your mod's unique ID, the translated mod's ID, and the provided language (unless your mod's ID already includes the language, or unless your mod is providing multiple languages). The `LocalizedMod` is the unique mod ID of the mod you are trying to add translations for. You can find this ID in the mod's `manifest.json`. The `LocalizingMod` is your mod's unique mod ID, as specified in your `manifest.json`. You can also modify your `manifest.json` to say your mod depends on Automate to be installed: ```json { // ... "Dependencies": [ { "UniqueID": "Pathoschild.Automate" } ] } ``` Alternatively, you can specify that the `EditData` action should only be applied if the Automate mod is installed: ```json { // ... "Changes": [ // ... { "Action": "EditData", "Target": "Shockah.ProjectFluent/ContentPacks", "Entries": { // ... }, "When": { "HasMod": "Pathoschild.Automate" } } ] } ``` This is enough for Project Fluent to figure out that the mod you created is providing translations for the Automate mod. The last step is to just create an `i18n` folder in your mod's folder, and start adding translations there. Note that your translations have to be the same type (i18n or Fluent based) as the translation system used by the translated mod -- you can't mix and match. To finish this example, we will create the `i18n` folder, and then a `pl.json` file inside of it, with our translations: ```json { "config.title.main-options": "Główne opcje", // ... } ```