How to send translatable components to players in their own, native language.
ALso, how to use Component.translatable() and Component.keyed() in Minecraft plugins to send native localized client messages.
In this episode, we’re going to cover:
- Getting user’s language — How to use player.getLocale() (or locale() on Paper
1.19+) to get the player’s language. - Using Adventure — Calling Component.translatable() and Component.keybind() to send localized messages.
- Replacing %s — Translating variables in localized messages.
- Finding localization keys — Where to find a list of all keys you can use.
- Creating a custom locale — How to create your own translation or send custom messages depending on what language the player chose.
Links:
- Native localization summary — Contains a summary of this lesson with actionable bullet points.
Source Codes:
Learn To Make Minecraft Plugins
Creating Minecraft plugins can be confusing, with most YouTube tutorials being painfully outdated, disorganized and offering no live support.
If you want to learn from the best and create truly customized plugins, see Project Orion. This is a full training tried and tested by 2,000+ people showing you step-by-step how to make plugins (minigames, custom mobs, antipiracy, dungeons, claims etc.) and much more!
You’ll get 2x/weekly 1:1 calls to review your code and get your questions answered, plus a 1,900+ community on Discord and our private portal, covered by 30-day guarantee. It’s just so much better experience than any blog post or video since I can pour my time and heart into it and teach you 100X faster than any free YouTube tutorial can. Click here to learn more!