Migrate mod translation to general resource pipeline
lycc193 opened this issue ยท 3 comments
In the original game, all i18n-related content was loaded into the resource pipeline through LocalizedContentManager.LoadString -> Load<Dictionary<string, string>>(assetName) for subsequent reading.
However, in SMAPI, there are only two ways to load language files:
- Initialize mod: SCore.LoadMods -> SCore.ReloadTranslations -> Load mod/i18n/locale.json
- reload command: ReloadI18nCommand -> SCore.ReloadTranslations -> Load mod/i18n/locale.json
Apart from these, all calls to translations are read-only, retrieving target values from a list maintained by smapi using keys, rather than reading from the resource pipeline.
In the OnLocaleChanged event, translations are also treated differently. Other resources are redirected through the resource pipeline via suffixes.
Hi! As discussed in #954:
- Mods can add translations as a content asset (just like any other data), in which case content packs can edit them.
- If they don't do that, internal mod data can't be directly edited by other mods (including translations). This is currently by design; if you want to change that, see the next point.
- GitHub issues are not the place for proposal discussions, since very few players and mod authors watch these issues. This is clearly indicated by the issue creation template you see when creating an issue. Instead you can discuss proposals in #making-mods-general on Discord, where many others can join the discussion too.
To reiterate, please discuss proposals in #making-mods-general on Discord where other mod authors can provide feedback too. Any further proposals for this on GitHub issues will be closed as duplicate of the existing discussion.
I've gone through https://stardewvalleywiki.com/Modding:Modder_Guide
, https://github.com/Pathoschild/StardewMods/blob/develop/ContentPatcher/docs/author-guide.md
, and the source code of SMAPI, but I couldn't find any mention of adding translations as content assets. Could you please clarify where you meant by this?
I'm referring to the translations for mods, not the original game's translations.
Treating mod translation files differently is a functional deficiency of SMAPI.
On Discord, I haven't seen any channels dedicated to discussing SMAPI itself. All discussions regarding translation files seem to be based on the original game's translations.
While this current distinction does not affect mod creators, it can significantly impact mod translators. Similarly, I haven't found any Discord channels discussing mod translations.