You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SMAPI will not correctly use an en.json or en-EN.json file as it should for i18n. It should prioritize the latter, then the former, and then finally default.json, but specifically for English, it will only utilize default.json and ignore the other two. The issue happens in Translator:GetRelevantLocales and more upstream in one of BaseContentManager's two GetLocale functions. The overloaded GetLocale function grabs the language string from Stardew Valley itself, which returns an empty string specifically for the English language instead of a locale code like en-EN. This empty string makes its way back to GetRelevantLocales where the while loop sees an empty string and so skips to just adding default as the only relevant locale, which then means the eventual code that loads the actual .json files only knows to load default.json.
In my testing, making BaseContentManager.GetLocale(LanguageCode language) return en-EN if it receives an empty string from the game was enough to make SMAPI correctly load my en.json i18n file, though I can't say I'm fully aware of any consequences of doing so elsewhere in SMAPI (i.e. I don't know if anywhere else strictly relies on an empty string for the English locale, such as maybe locale-specific asset loading). Adjusting GetRelevantLocales is probably better.
To Reproduce:
Create an i18n folder in your mod and populate a default.json
Create an en.json with values that differ from default.json
Use the i18n system for some text in-game
Launch the game and see that the game uses your default.json values instead of your en.json values, even when your game is set to the English locale.
The text was updated successfully, but these errors were encountered:
SMAPI will not correctly use an
en.json
oren-EN.json
file as it should for i18n. It should prioritize the latter, then the former, and then finallydefault.json
, but specifically for English, it will only utilizedefault.json
and ignore the other two. The issue happens in Translator:GetRelevantLocales and more upstream in one of BaseContentManager's two GetLocale functions. The overloaded GetLocale function grabs the language string from Stardew Valley itself, which returns an empty string specifically for the English language instead of a locale code likeen-EN
. This empty string makes its way back to GetRelevantLocales where the while loop sees an empty string and so skips to just addingdefault
as the only relevant locale, which then means the eventual code that loads the actual .json files only knows to loaddefault.json
.In my testing, making
BaseContentManager.GetLocale(LanguageCode language)
returnen-EN
if it receives an empty string from the game was enough to make SMAPI correctly load myen.json
i18n file, though I can't say I'm fully aware of any consequences of doing so elsewhere in SMAPI (i.e. I don't know if anywhere else strictly relies on an empty string for the English locale, such as maybe locale-specific asset loading). AdjustingGetRelevantLocales
is probably better.To Reproduce:
default.json
en.json
with values that differ fromdefault.json
default.json
values instead of youren.json
values, even when your game is set to the English locale.The text was updated successfully, but these errors were encountered: