-1

I am using OJS cms, which is a Open Journals System. I want to add some parts to registration page. In registration page I want to know what language/locale is set, in order to put some more fields if specific language/locale is set.

I want current locale of the site. How can I recognize what locale is set by user by if statement? I searched stackoverflow but and found some result but non of them were helpful for me.

By the way, this cms is written by PHP. For more inforemation click here.

deceze
  • 510,633
  • 85
  • 743
  • 889
MJB
  • 65
  • 13
  • 3
    You want to know what language is set *in the browser* from PHP? You can't. You can only go by the voluntary `$_SERVER['HTTP_ACCEPT_LANGUAGE']` data. – deceze Dec 11 '17 at 13:16
  • I tried $_SERVER['HTTP_ACCEPT_LANGUAGE'] but this always give me: en-US,en;q=0.9 even my site language is not English. What should I do? – MJB Dec 11 '17 at 13:25
  • It doesn’t tell you what language your site is in, it tells you what language the browser prefers; i.e. its locale setting. Or what else do you want to know‽ – deceze Dec 11 '17 at 13:27
  • My site has 2 languages. I want to figure out while filling up registration form, what language is selected by the user. – MJB Dec 11 '17 at 16:15

1 Answers1

0

The best way is to use {$currentLocale}. It tells us what language the website is set in.

MJB
  • 65
  • 13