• Resolved jraminhos

    (@jraminhos)


    Hi,
    Is there any way to identify the language in use in a Worpress site which is using TranslatePress?
    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Cristian Antohe

    (@sareiodata)

    Hello,

    Yes. There are several ways.

    * in PHP you can use the $TRP_LANGUAGE global variable
    * we also setup a cookie “trp_current_language” with the language that you can access from JS and PHP
    * in the body class you’ll find the current language: like so: translatepress-en_US

    If there’s anything else, please let me know!

    Hi,

    I have defined a global variable like
    global $TRP_LANGUAGE;
    With this variable, when I am doing
    echo $TRP_LANGUAGE;
    it returning en_US, zh_HK like this. But I need the actual code, which is passing through the url i.e. en, hk like this.
    So, can you please help!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Current language’ is closed to new replies.