-
-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin Translations #146
Plugin Translations #146
Conversation
Good stuff in general, here are my thoughts:
|
so we could have a lets say, |
That a good point! I don't think that it's necessary to split locales into different files as it is done in web apps, for example. |
I would like to use the same localizer for core, and the idea of a giant file with all locales does not seem fun to edit for me personally. Especially if someone wants to add an entire language they can just add a new file and the diff is easier to read. We could probably allow a nested json file option but I'd want to support both |
I'm not talking about one giant file, different files but not for language codes. I don't mean the whole implementation, just how the files are separated and we could have a loader so the core could load its own translations, and plugins could do the same |
I'm just not sure I see the value in having multiple translation files (except for locale) per plugin; I can't see the scope of a plugin being so large that they need more than 1 language file for english for instance |
IStringLocalizer
to the base plugin, as well as adding this to the DI Containerlang
for any valid locale json files, such asen.json
,en-AU.json
,fr.json
etc."Hello {0}, your ID is {1}"
en-GB
will try to read from anen-GB
locale file first, and thenen
if missing. They always fall back toen
if a key cannot be found.en
. This will change all localized strings into that language, unless there is another language context present (like a user command will return information in a users language).css_lang
or!lang
command which will print your current language, as well as accept an argument to change your language, i.e.!lang de
will change to German,!lang en-AU
will change to English Australia etc.IPlayerLanguageManager
which simply maps a SteamID to a culture info, or defaults to server language if not found. There is no cleanup process for this list at the moment so it would slowly leak memory if every single player sets their language and you have thousands of unique users (not really a concern yet).CCSPlayerController
calledGetLanguage
which returns the users configured language or a default language if they have not set one.TemporaryCulture
disposable which is used to set the current thread language until disposed, this is currently used in command handlers from the plugin side.libicu
is required.{orange}This{default} text has {green}green{default} text