Recently, I’ve been writing some “library code” to be used as part of other projects.
Normally, when writing some business logic code, you may define some entities, structures and presentation logic along with the localisable texts that are used with them in their respected layers. I have a library that offers some structures, usable as part of logic, but the library also offers some datasets of predefined entities with data, which includes numbers and enums, but also string literals, that would/should be internationalised to match the user’s locale.
For time being, I wrote a simple internal localisation framework with Kotlin in mind, but also looked into full-blown packages like ICU4J.
Do you have some well established ways of writing such library code, where the consumer would then specify the desired locale of the strings the library entities’ text would then come in? Or some links to library code bases where I could take a look?