Skip to content

Commit aeef9cf

Browse files
7rebuxzlataovce
andauthored
docs: update adventure internationalization examples (#562)
* Update i18n.mdx * add semicolon Co-authored-by: Matouš Kučera <[email protected]> --------- Co-authored-by: Matouš Kučera <[email protected]>
1 parent bf44be7 commit aeef9cf

File tree

1 file changed

+6
-6
lines changed
  • docs/paper/dev/api/component-api

1 file changed

+6
-6
lines changed

docs/paper/dev/api/component-api/i18n.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Adventure's Javadocs for all-things translations can be found [here](https://jd.
1919
All translation is done through [`GlobalTranslator`](https://jd.advntr.dev/api/latest/net/kyori/adventure/translation/GlobalTranslator.html).
2020
You can render translations yourself and add new sources for translations.
2121

22-
You can add sources to the `GlobalTranslator` by creating instances of [`TranslationRegistry`](https://jd.advntr.dev/api/latest/net/kyori/adventure/translation/TranslationRegistry.html)
22+
You can add sources to the `GlobalTranslator` by creating instances of [`TranslationStore`](https://jd.advntr.dev/api/latest/net/kyori/adventure/translation/TranslationStore.html)
2323
or implementing the [`Translator`](https://jd.advntr.dev/api/latest/net/kyori/adventure/translation/Translator.html) interface yourself.
2424

2525
## Where translations work
@@ -45,16 +45,16 @@ some.translation.key=Translated Message: {0}
4545
```
4646

4747
```java
48-
TranslationRegistry registry = TranslationRegistry.create(Key.key("namespace:value"));
48+
TranslationStore store = TranslationStore.messageFormat(Key.key("namespace:value"));
4949

5050
ResourceBundle bundle = ResourceBundle.getBundle("your.plugin.Bundle", Locale.US, UTF8ResourceBundleControl.get());
51-
registry.registerAll(Locale.US, bundle, true);
52-
GlobalTranslator.translator().addSource(registry);
51+
store.registerAll(Locale.US, bundle, true);
52+
GlobalTranslator.translator().addSource(store);
5353
```
5454

55-
This creates a new `TranslationRegistry` under a specified namespace. Then, a <Javadoc name={"java.util.ResourceBundle"} project={"java"}>`ResourceBundle`</Javadoc>
55+
This creates a new `TranslationStore` under a specified namespace. Then, a <Javadoc name={"java.util.ResourceBundle"} project={"java"}>`ResourceBundle`</Javadoc>
5656
is created from a bundle located on the classpath with the specified <Javadoc name={"java.util.Locale"} project={"java"}>`Locale`</Javadoc>.
57-
Finally, that `ResourceBundle` is added to the registry. That registry is then added as a source to the `GlobalTranslator`.
57+
Finally, that `ResourceBundle` is added to the store. That store is then added as a source to the `GlobalTranslator`.
5858
This makes all the translations available server-side.
5959

6060
Now you can use translation keys in translatable components.

0 commit comments

Comments
 (0)