1.15.2 Creating localizations for plugins to support multiple languages

Discussion in 'Spigot Plugin Development' started by maxbridgland, Mar 5, 2020.

  1. I have been unsuccessful in trying to find a good tutorial or anything on adding localization support to your plugin. Are there any frameworks or a built-in to Bukkit that allows things like this? You could provide a language file (maybe JSON or XML) with a language dict for normal string -> localized string.

    Does this exist? If not, would any developers find it useful if I made a framework for this?
     
  2. SteelPhoenix

    Moderator

    You can use Player#getLocale() to get a player's language settings

    Also, you can look at plugins like EssentialsX and see how they handle multiple languages, but basically they just load a different resource bundle depending on the locale defined in its configuration.
     
  3. Utilizing player.getLocale() will allow you to access what language the player has selected allowing you to change the messages dependent on their selection. Notice Minecraft supports a lot of languages so make sure that you do support them all if you decide to do multi-language.
     
  4. Not necassarily support all. You could support a few, and if the player's locale is unsupported use English
     
  5. I think it would be down the developer for what they include for locales supported. Not everbody can reliably translate their language to another without a native speaker or years of practice. I'm working on a framework right now as we speak to easily load and apply localizations from JSON dictionaries of the default:localized strings. Should be ready tonight or tomorrow :)