Skip to content
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

feature(api, minimessage): Replace TranslationRegistry with a generic TranslationStore #1182

Open
wants to merge 5 commits into
base: main/4
Choose a base branch
from

Conversation

kezz
Copy link
Member

@kezz kezz commented Mar 7, 2025

This PR deprecates for removal the entire TranslationRegistry system in favour of a more generic TranslationStore system.

Having a generic system allows us to easily implement a TranslationStore for Component or MiniMessage translation (which this PR does).

Additionally, an abstract implementation of TranslationStore is provided for those who may wish to make their own custom type of TranslationStore. For example, one could easily create a JSONTranslationStore that provides component-based translations reading from a list of JSON strings.

For those scared about the big deprecation, it's a simple one line change for your codebase, no other API surface has been changed. Additionally, the old system continues to work identically to the new one.

- final TranslationRegistry myRegistry = TranslationRegistry.create(myKey);
+ final TranslationStore.StringBased<MessageFormat> myRegistry = TranslationStore.messageFormat(myKey);

Closes #1184

… TranslationStore

Also adds Component and MiniMessage TranslationStore implementations.
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.

Add a way to query if a translation store contains a making for key/locale
1 participant