Configuration Localisation
Pheotis opened this issue ยท 4 comments
When we get around to a full release, we will need to handle config localisation for non-english distribution channels.
The config system is currently finicky, so it will probably be a slight pain to implement.
When we get around to it, this file should help:
I probably have asked this question before, but how exactly do we know the language to be localized? Although this will be a mess, here's actually one solution:
- Load the language from the config
- Check against an internally stored property whether this language has been set already
- If that was not the case, load the translated configuration comments into the old config file without removing config data
- Store an internal property that the modified language has been set
The hard part here of course is number 3.
This is the only behavior that I can see working; the configuration will have to be English initially, as there's no good reliable way to check the localization on a server. Like the server does not have to be located in the same region as that of the server owner. I really see no other reliable way, but let me see if I can find system properties that might give something interesting
There is apparently the
Locale.getDefault();
But I'm unsure how reliable it is. It's quite hard to know what the system owner wants from that setting. For example I myself would like the configuration to be in English, even though my locale would be Swedish. There's no way for the system to know that. Therefore I suggest not using that property
3. If that was not the case, load the translated configuration comments into the old config file without removing config data
The migrator has some code which ensures that the comments of the updated config.yml is used, but values are taken from the user's configuration, after the keys have been updated. It should be possible to do the same for changing the configuration language. We should be able to copy (or generalize) that code from the migrator and use the user's current configuration as the input, and the translated configuration file as the one to take comments from.