setup files to translate

Steps

  • Create File

    Go to languages folder , and create file .jso format

  • Rename File

    Rename file to language ISO Code that set in localCode in config file

  • File Content

    the content of file Must be Like this:

    
    {
    "File-Name" :
        {
            "the orginal text was be here" : "here set translation"
        }
    }
                            

    Example
    
    {
        "ar-JO" :
        {
            "Hello" : "مرحبا"
        }
    }
                            
Retrieve Translation

Get Translation

  • Function NO.1

    print directly

    
    __("orginal text");
                                    

    Example
    
    __("Hello");
    // if selected language is arabic the output will be مرحبا
                                    

    you can retrieve text in language forced if you want for example :
    when detect user language you want to echo alert message to user in detected language not in default language

    
    __("Hello", "ru");
    // the output will be in Russian language even if the selected language is other one    
  • Function NO.2

    NOT printing directly

    
    echo _x("orginal text");
                                    

    Example
    
    echo _x("Hello");
    // if selected language is arabic the output will be مرحبا
                                    

    you can retrieve text in language forced if you want for example :
    when detect user language you want to echo alert message to user in detected language not in default language

    
    echo _x("Hello", "ru");
    // the output will be in Russian language even if the selected language is other one