Skip to content

Add Language API#1142

Merged
BillyGalbreath merged 2 commits into
PurpurMC:ver/1.19.2from
MelnCat:feat/language-api
Oct 5, 2022
Merged

Add Language API#1142
BillyGalbreath merged 2 commits into
PurpurMC:ver/1.19.2from
MelnCat:feat/language-api

Conversation

@MelnCat

@MelnCat MelnCat commented Oct 2, 2022

Copy link
Copy Markdown
Contributor

This pull request adds a Language API to translate translation keys and Translatables into the default server language, along with checking if a translation key can be translated. This is useful for cases where it isn't possible to use text components, but you still need a Translatable turned into human readable text.
Without this API, to translate translation keys you would need to either use NMS, or use the adventure plain text serializer. However, the plain text serializer needs wrapping the translation key into a TranslatableComponent then running the serializer on it, while having this API would make it a simple method call which goes to an ImmutableMap access. It was also not possible to check if a given translation key could be translated with the plain text serializer.

@BillyGalbreath BillyGalbreath merged commit b54122a into PurpurMC:ver/1.19.2 Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants