I wonder if there is a way to update localization for dialogues after the game is built?
For example, if I need to implement a new language for the game, and want to make as an option to add languages as a mod for Steam workshop. I couldn't find any info about it.
[Question] Update localization in the existing build
Re: [Question] Update localization in the existing build
Hi,
Would these be mods that other people would create, or would you be releasing them as the game's developer?
If you're releasing them as the game's developer, you can either add the localization to the existing dialogue database (e.g., as a patch or DLC), or create a new database that has all the same content as the original but just localized to a specific language. If you create a new database, in C# use DialogueManager.RemoveDatabase() to remove the original database from memory and DialogueManager.AddDatabase() to load the new localized database into memory.
If the mods are something that other people would create, I can think of a few options. If you use the Dialogue System's i2 Localization integration, you could use the integration's runtime localization component and use i2's source.Import_CSV() method to import a new translation into i2. If your modders have the Dialogue System, they can add their translations to a dialogue database and export it in Chat Mapper XML format; then you can import it at runtime and use DialogueManager.AddDatabase(). Or you could use the Dialogue Editor's Database > Localization Export/Import to export CSV files. Modders can then add a translation to the CSV file, and you could adapt (copy) the Localization Export/Import section's import code to import it at runtime.
I know The Game Kitchen (Blasphemous, The Last Door) crowdsourced localization for The Last Door. I don't know the exact details of how they implemented it, but it shows that it's quite possible in the Dialogue System.
Would these be mods that other people would create, or would you be releasing them as the game's developer?
If you're releasing them as the game's developer, you can either add the localization to the existing dialogue database (e.g., as a patch or DLC), or create a new database that has all the same content as the original but just localized to a specific language. If you create a new database, in C# use DialogueManager.RemoveDatabase() to remove the original database from memory and DialogueManager.AddDatabase() to load the new localized database into memory.
If the mods are something that other people would create, I can think of a few options. If you use the Dialogue System's i2 Localization integration, you could use the integration's runtime localization component and use i2's source.Import_CSV() method to import a new translation into i2. If your modders have the Dialogue System, they can add their translations to a dialogue database and export it in Chat Mapper XML format; then you can import it at runtime and use DialogueManager.AddDatabase(). Or you could use the Dialogue Editor's Database > Localization Export/Import to export CSV files. Modders can then add a translation to the CSV file, and you could adapt (copy) the Localization Export/Import section's import code to import it at runtime.
I know The Game Kitchen (Blasphemous, The Last Door) crowdsourced localization for The Last Door. I don't know the exact details of how they implemented it, but it shows that it's quite possible in the Dialogue System.
Re: [Question] Update localization in the existing build
Hi! Thanks for the fast reply!
I want to add an option for people to work on translation without needing Unity at all. Like, they updated the .csv file with localization in their installed game and can try and check it (and later upload it to Steam as a modification, so other people could use it as well). In that case, they don't need Unity and can test their progress in real-time, without waiting till the new build will be uploaded (because it's more convenient to just replace one file in Streaming Assets folder)
I want to add an option for people to work on translation without needing Unity at all. Like, they updated the .csv file with localization in their installed game and can try and check it (and later upload it to Steam as a modification, so other people could use it as well). In that case, they don't need Unity and can test their progress in real-time, without waiting till the new build will be uploaded (because it's more convenient to just replace one file in Streaming Assets folder)
Re: [Question] Update localization in the existing build
Then it sounds like the best solution will be to export your original dialogue database content to CSV files using the Dialogue Editor's Database > Localization Export/Import feature.
Then write some code that reads the modder's version of the CSV files and does the same thing as the the Dialogue Editor's ImportLocalizationFiles() method, which you can find in Plugins / Pixel Crushers / Dialogue System / Scripts / Editor / Dialogue Editor / DialogueEditorWindowLocalization.cs.
Then write some code that reads the modder's version of the CSV files and does the same thing as the the Dialogue Editor's ImportLocalizationFiles() method, which you can find in Plugins / Pixel Crushers / Dialogue System / Scripts / Editor / Dialogue Editor / DialogueEditorWindowLocalization.cs.