Implement support for server-side localized text#234
Conversation
e7f17f1 to
4f27696
Compare
There was a problem hiding this comment.
It would be cool to have a config for this.
Especially for servers which are hosted on big server providers without the ability to change the systems locale.
There was a problem hiding this comment.
yeah, the server's default locale is in a separate option so that something like that can be done without a ton of difficulty.
4f27696 to
e5cbe29
Compare
|
@zml2008 Could you please show me where the server side translations (ex from resource bundles) are converted into something that is send to the client? Text.Translatable translatable = ...;
Translation translation = translatable.getTranslation();
if (translation instanceof ClientTranslation) { // or registry.isClientTranslation(translation))
// ClientTranslation is a translation that will take place client side
client.sendChatComponent(new TranslationTextComponent(
translation.getId(),
wrapArguments(translatable.getArguments())
));
} else {
// otherwise resolve the translation on the Server side
client.sendChatComponent(new TranslationTextComponent(
// client.sendChatComponent(new ArgumentsTextComponent(
translation.get(client.mpplayer$getLocale()),
wrapArguments(translatable.getArguments())
));
} |
|
here's where the translation happens: https://github.com/SpongePowered/Sponge/pull/234/files#diff-9c3cc48564d143b45fc6a560c9f753c9R47 and here's where the player requests the translation: https://github.com/SpongePowered/Sponge/pull/234/files#diff-d6fac8c79b179f2e91fbd409d4a8b28fR121 |
|
Thanks |
e5cbe29 to
f6ed956
Compare
f6ed956 to
b893624
Compare
Companion to SpongePowered/SpongeAPI#563