Content Patcher

Content Patcher

378k Downloads

[Content Patcher] Please provide a translation interface

lycc193 opened this issue ยท 2 comments

commented

Add translation-related APIs to allow loading i18n files for specific mods through third-party content packages. As mentioned in the previous issue, currently only cp can access the relevant interfaces.

example:

{
    "Changes":{
        "Action":"Load",
        "Target":"mod_uuid/locale/zh"
        "FromFile":"asset/xxxx/zh.json"
    }
}
commented

Hi! I replied on Pathoschild/SMAPI#954; see there for more info.

Content Patcher technically has access to internal SMAPI code, but that's only to minimize the performance impact of working with relevant public types like IAssetName. It's not meant to access internal implementation details, which are subject to change.

commented

I have gone through the CP's source code, and the only reference to translation files is TranslationValueProvider. This method only retrieves the read-only list provided by smapi and replaces the i18n tokens in the content package with this list. There are no methods for modification. The original language files are all located in StringsFromCSFiles, while the mod's language files are maintained separately by smapi and do not enter the original game's asset pipeline.
As I've repeated multiple times before, the i18n files are read by smapi, not cp. cp cannot even access the language files, so how can it modify them?
The methods you mentioned in the previous issue are ineffective, unless there are extensive modifications, which would result in writing a lot of useless code and cannot be specifically targeted at modifying translation entries. This will inevitably affect the compatibility with future updates of the main mod.

From the beginning to the end, I have only suggested that smapi/cp include translation files equally in the asset pipeline to facilitate modifications through similar methods. That's all.