Need help with translating

Discussion in 'Plugin Development' started by nateracecar5, Aug 29, 2014.

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

    nateracecar5

    Hi! I have a question for the devs that already have translated their plugin:

    I have a plugin I would like to keep going for a while, and an essential feature I think it needs is multiple languages. I know what I need to do, but I don't know how to do it. What I need to do is:

    • Create a messages.yml file, and be able to access it from any class, anywhere in the plugin
    • Detect what language the server is using automatically, and translate to that language.
    Any way I can at least accomplish the first one? I may be able to do a config option for the second, but would like the auto-translate feature. Thank you!
     
  2. Offline

    _LB

    Add a method do your main class that obtains a translation string from your translation file. I have minimalist support for translations in my plugin, this is my implementation:
    https://github.com/LB--/KataParty/b...tuff/kataparty/KataPartyPlugin.java#L438-L455

    And the config file:
    https://github.com/LB--/KataParty/b..._stuff/kataparty/config-defaults.yml#L41-L172

    The way you implement translations depends on your preferences as a developer and your goals for the end user experience. I went with the lazy approach.
     
  3. Offline

    nateracecar5

    _LB Okay, I'm having a little trouble reading your method. Could you explain?
     
  4. Offline

    _LB

    nateracecar5 It's pretty straightforward, which line numbers specifically are you having trouble with?
     
  5. Offline

    nateracecar5

    Well, I'm kind of new to java, for instance, I don't know what that "Object... parameters" part means, and I'm not sure how to use it to send messages to players. Also, how does it get the language to translate to?
     
Thread Status:
Not open for further replies.

Share This Page