Per player localization

Guide to use per player localization

messages.yml is now messages_en.yml and you can create more using proper language codes like messages_de.yml for german.

Examples: en-US, en-UK, en, de, sk, hu In this file, you can add a new section, named custom (which is already there if you do a fresh install:

custom:
  stash-title: Item stash
  prev-page: '&fPrevious Page'
  npc:
    quests: <white>Quests

These values are available in the plugin menus like item stash. You can reference them as {{stash-title}} or {{npc.quests}}. Notice the dot (.) notation for nested structures.

These are also exposed as PlaceholderAPI placeholders: %aurora_lang_<key>% for example: %aurora_lang_npc.quests%

This allows you to add per player localization to any plugin that supports PlaceholderAPI placeholders.

To enable per player localiaztion:

In your config.yml you have to:

  • add the language codes you support in supported-languages

  • choose your default language and set it to locale field

  • set use-per-player-locale to true

And then you have to:

  • grant the aurora.core.user.language to the players so they have access to the /language command After all these, players will be able to use their desired language.

Notice that in config.yml the number-format section also have a locale value. That is only used when per player locale is disabled, otherwise it will use the player's selected locale.

Default value of the custom section in the migrated messages_en.yml file

custom:
  stash-title: "Item stash"
  prev-page: "&fPrevious Page"
  prev-page-lore: "&7Click to go to the previous page"
  next-page: "&fNext Page"
  next-page-lore: "&7Click to go to the next page"
  current-page: "&fCurrent Page &7({current}/{max})"
  current-page-lore: "&7You are currently on page {current}"
  stash-collect-all: "&aCollect all"
  stash-collect-all-lore: "&7Click to collect all items"
  close: "&cClose"
  close-lore: "&7Click to close the menu"

As you can see, these are values for the stash menu. The updated default config that uses these values can be viewed on:

Item stash

If you want to use these placeholders in menus, there is a handy utility in AuroraLib which lets you wrap lines by word count in any of the item lore options:

some-menu-item:
  name: "{{my-item-name-language-placeholder}}"
  slot: 1
  lore:
    - "[wrap:25] {{my-item-lore-language-placeholder}}"

You can nest plugin placeholders like {name} , papi placeholders like %player_name% and language placeholders like {{language-placeholder}} in any depth.

Last updated