1.15.2 Language Support

Discussion in 'Spigot Plugin Development' started by Tarluin, Feb 26, 2020.

  1. Looking for information on the proper way to handle different languages.
    Any links or examples would be appreciated.

    Thank You.
     
  2. Have a config value that tells you which language file they want to use. Just make sure that the keys in all language files are the same.
     
  3. Make different language subfolders, like en_US and put a strings.yml in it. In there, put all your strings that you wish to have translated. Use the main config to handle which of theses to use.
     
  4. You can create language files in resources using:
    • Custom .yml Configuration
    • Java .properties Configuration
    First, create your language file. You can use .yml file or .properties file.

    Example of language file as yaml
    Code (YAML):
    text1: This is text A.
    text2
    : This is text B.
    Example of language file as properties
    Code (Text):
    text1=This is text A.
    text2=This is text B.
    Then create some language manager for loading your language files.
     
  5. Should the language files remain in the jar or be copied to the plugin data folder?
     
  6. Its better to create language files in the plugin folder or better yet sub folder in there, that way you will have easy access to it and can change some of the messages.
     
    • Agree Agree x 2