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

Solved Not work this code help me

Discussion in 'Development' started by korado531m7, Mar 28, 2018.

  1. korado531m7

    korado531m7 Slime

    Messages:
    77
    GitHub:
    korado531m7
    i’m trying to make a function that change language woth getLocale

    i created a function
    PHP:
    public function sendEachLang($player$en$jp){
        if(
    $player->getLocale() == “ja-JP”){
            return 
    $jp;
        }else{
            return 
    $en;
        }
    }
    and, i tried to send (japanese mode)
    but it doesn’t work(sent in english)
    how can i fix this?
     
  2. yuko fuyutsuki

    yuko fuyutsuki Slime

    Messages:
    77
    GitHub:
    fuyutsuki
    https://github.com/pmmp/PocketMine-...88ab6ee01fa2a0/src/pocketmine/Player.php#L776
    Read this, You specified "ja-JP", but correctly it is "ja_JP".
     
  3. korado531m7

    korado531m7 Slime

    Messages:
    77
    GitHub:
    korado531m7
  4. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    dude, you really should consider a better way to manage local
    like you should use lang.yml
    and get things with langcode
    since this will get messy when you want to add support, for say another language
     
  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.