1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Change the text in terms of the language

Discussion in 'Development' started by PiloudeDakar, Jul 16, 2021.

  1. PiloudeDakar

    PiloudeDakar Witch

    Messages:
    62
    GitHub:
    piloudedakar
    Someone can explain to me the method to do it ?
     
  2. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    You…go to ur minecraft settings and change the language..????
     
    Agent likes this.
  3. PiloudeDakar

    PiloudeDakar Witch

    Messages:
    62
    GitHub:
    piloudedakar
    No bro in plugins
     
  4. Axon

    Axon Zombie

    Messages:
    276
    You are saying you want to change the languages in the plugins text?
    Change the translation file if present. or modify the code.
     
    Agent and minijaham like this.
  5. PiloudeDakar

    PiloudeDakar Witch

    Messages:
    62
    GitHub:
    piloudedakar
    Yes, I want to know how to create different text in terms of the language of the client
     
  6. xLeakDev Enzo

    xLeakDev Enzo Spider Jockey

    Messages:
    38
    GitHub:
    nya-enzo
    PHP:
    /** @var pocketmine\Player $player*/
    $lang $player->getLocale();
    /*For example, if english,
     * $lang = "en_US"
     * if french,
     * $lang = "fr_FR"
    */
     
    PiloudeDakar likes this.
  7. PiloudeDakar

    PiloudeDakar Witch

    Messages:
    62
    GitHub:
    piloudedakar
    And after, how can we use this exemple of text (with en_US en_En fr_Fr and other lang files) 'lang.text.factionkick' to change the text in terms of the language ?
     
  8. Axon

    Axon Zombie

    Messages:
    276
    You can use a config like en_us.yml to translate text. Eg:
    Code:
    command.Feed = “You’ve feed yourself”
     
    Agent likes this.
  9. xLeakDev Enzo

    xLeakDev Enzo Spider Jockey

    Messages:
    38
    GitHub:
    nya-enzo
    yeah for example you could make configs with your things defined, and chanhe the message if the player is english, french etc
     
  10. PiloudeDakar

    PiloudeDakar Witch

    Messages:
    62
    GitHub:
    piloudedakar
    In the plugin, I have just to type $text = "lang.text.example"; ?
     
  11. xLeakDev Enzo

    xLeakDev Enzo Spider Jockey

    Messages:
    38
    GitHub:
    nya-enzo
    No, you would have to get the language, and if the language is english, get your config for english and get "lang.text.example"
     
  12. PiloudeDakar

    PiloudeDakar Witch

    Messages:
    62
    GitHub:
    piloudedakar
    Ok, thanks a lot !
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.