Localization - Best way to do this?

Discussion in 'Plugin Development' started by hskrasek, Jul 10, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    hskrasek

    Alright so I have a very simple question for my fellow developers. How should I do localization? The most requested feature I have to date is allowing people to change the messages the plugin post to be in their native language.

    I don't want to just allow every single message to be customized, because thats just taking the easy way out and a shoddy method if you ask me.

    So whats the best way to localize my plugin?
     
  2. Offline

    EnvisionRed

    Create a lot of Lang.txt files (like Lang_EN.txt, Lang_FR.txt, Lang_ES, etc.) and unpack them to a directory within your plugin's data directory. They will all follow the same format, so for english it would be like "deathMessage: 'A player has died!'" and for spanish, "deathMessage: 'Un jugador ha muerto!'"

    In the config, allow users to choose which file is interpreted for the strings. Then just take all strings that get called from there.
     
  3. Offline

    hskrasek

    I suppose that could work, just was wondering if there was an easier way that didnt require adding more files to the JAR. Well if anyone else has any suggestions like this or an even better way just let me know.

    It would be greatly appreciated.
     
  4. Offline

    Kaikz

    Just allow people to change the strings themselves.
     
  5. Offline

    EnvisionRed

    Yeah, you can hook into bukkit's config API to make it a lot easier for you as well. Just make a strings.yml file and have that unpack to your plugin's directory.
     
Thread Status:
Not open for further replies.

Share This Page