Internationalization
We'll need to find a good library for this or make one ourselves for C# (honestly i'm fine with either)
Here i'm listing some of the important code changes that need to happen refresh side. Feel free to split any of these off into separate issues
- [ ] Detect the language a user has selected ingame on first login and store that in the database as that user's default language, since the game sends that to us
- [ ] Notifications need to be localizable
- [ ] We can localize the description for this fake system user, its minor but i feel any text we can translate, we should
- [ ] API errors. These should return "localization keys" of some sort alongside the text itself, so that the frontend can localize it, since in the case of the "registration is disabled" message or the "register next step" message, we cant really know what language in the backend should be displayed. Not all API errors need to be localized, just the ones which are likely user-facing and that a user is intended to read. Although maybe those shouldn't be API errors in the first place if its meant to be a user-facing result.
- [ ] News needs to be localizable. It should be possible as a server owner creating news events to specify news text in multiple languages, and the server should pick the correct one for the users.
- [ ] Restricted message
Thinking about it more, what more should be localizable? Why not localize developer slot names (since iirc those are translated in the original game) Since we are extracting these names from localization files anyway (once i actually get around to finishing that tooling) it shouldnt be hard to pull out the names for all the languages
maybe we should have a LocalizableString type which when serialized picks the right string for the language
eg.
[XmlRoot("bla")]
public class Whatever {
public LocalizableString Name { get; set; } = "localization_key_goes_here"; //implicit cast
public void FillInExtraData(GameUser user) {
this.Name.Target = user.Language;
}
}
This would make localizing things like this quite easy