SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

Language changed event

TehPers opened this issue ยท 3 comments

commented

With SDV 1.2, we have a new language setting that can be changed in game. Mods, however, can't really detect when the language is changed and update the strings without constantly checking the current language. Can you add a language changed event to SMAPI? It'd allow mods to easily know when the language is changed and switch all the strings that it uses to the correct ones for the current language.

Implementing this feature in a mod would be easy, you'd just need a single config class called Strings or something that contains all the strings you use, then multiple versions of that config, one per supported language. The default values would be in the default language (English?) and you can have versions of the file for each of the other languages that you support.

commented

Wait I'm an idiot, they added this:

LocalizedContentManager.OnLanguageChange
commented

I think it makes sense for SMAPI to expose its own event like ContentEvents.AfterLanguageChanged, since the Stardew Valley developers might change that without warning. It'll just be very easy to implement. ;)

commented

Done in the upcoming 1.9 release.