FujiAPI / Fuji

Celeste 64 Mod Loader
30 stars 10 forks source link

Move localization handling to its own class #61

Closed Wartori54 closed 6 months ago

Wartori54 commented 6 months ago

This abstracts localization handling from all the constructors of all the classes derived from Item to a single Localized class, the major benefit of this is code de-duplication. This does not require any changes from the user since Localized can be implicitly casted from string. In order to re-introduce the ability to draw unlocalized strings to the screen a subclass of Localized was added which can also be casted from a string but it must be done explicitly: (Unlocalized) "Hello, Fuji!", thus getting rid of any localized = true in the constructor parameters.

jasminegamedev commented 6 months ago

I'm still a little on the fence about this change personally and am a little unsure if casting to Unlocalized is going to be confusing or unclear for people who want to use these in an unlocalized way, but I suppose we can try it for a while and see how people react to it. Although if we're going in this direction I may do a small follow up change to this area to revert it back to how things were structured before my change to simplify things, where the menu items were using primary constructors on the class.