Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Plugin localisation/multilangue

Comments in 'Plugin Development' started by udwarf, May 6, 2016.

  1. udwarf
    Offline

    udwarf Active Member

    Joined:
    Apr 17, 2016
    Posts:
    61
    Minecraft User:
    1Zaza
    Hi!
    It should be already disscussed, but search didn't get me anything related

    What is the best approach to create multilanguage messages in plugins?
    So that player with english locale will receive message like "Hello, %playerName!" and french player will receive "Salut, %playerName!".

    I guess I should create some files with messages for all supported locales,
    somehow load them and then use construction like $player->
    sendMessage($server->getLanguage()->translateString("%helloMessage")

    Can anyone give an example or link to toutorial how to realise this ?

    Thank you.
  2. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    Last edited: May 6, 2016
    CraftYourBukkit likes this.
  3. udwarf
    Offline

    udwarf Active Member

    Joined:
    Apr 17, 2016
    Posts:
    61
    Minecraft User:
    1Zaza
    Thanx for an example.
    As I understood, pocketmine didn't provide any interface to help plugins realise multilang and each developer have to reinvent a wheel, right?
  4. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    You don't need a book to teach you how to do everything. In this case, PocketMine doesn't have pre-included multi-language support for plugins, so you can come up with a creative solution instead of expecting the answer to be in plain context.
    Last edited: May 6, 2016
  5. udwarf
    Offline

    udwarf Active Member

    Joined:
    Apr 17, 2016
    Posts:
    61
    Minecraft User:
    1Zaza
    I see that many developers here are quite annoyed. It surprising to me
    But thank you for an answer. Quoted phrase would be enough.
    Legoboy0215 likes this.
  6. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Like PocketMine does, store languages in an .ini file :)
  7. Irish
    Offline

    Irish Active Member

    Joined:
    Apr 24, 2016
    Posts:
    96
    Minecraft User:
    _Irish_
    You could get the name of an item in their hand and if it returns a different language, you could set the language. Something around that basis
  8. udwarf
    Offline

    udwarf Active Member

    Joined:
    Apr 17, 2016
    Posts:
    61
    Minecraft User:
    1Zaza
    Yep. But I guess just storing in file ain't enough :)

Share This Page

Advertisement