0

When I run the website built on CakePHP on a local server, it shows the correct, non-english version. However, if I run it on a server it shows the english version. I can manually set the language in core.php, but I want CakePHP to one of the two versions depending on the user's language. How can I manage that?

With kind regads,

Battlestr1k3

3
  • Which version of Cake? Are you using cakephp's i18N? Commented Mar 30, 2015 at 12:17
  • Read the manual? It's described in detail on that page book.cakephp.org/2.0/en/core-libraries/… including sample code. Commented Mar 30, 2015 at 12:37
  • Sorry burzum, but as I described, I want CakePHP to automatically set the language based on the users (browser-)language. Yes, I am using CakePHP's i18n-System. Thank you for your answers. Commented Mar 30, 2015 at 14:06

1 Answer 1

1

Here's a good article on this topic:

https://www.dyeager.org/blog/2008/10/getting-browser-default-language-php.html

Which basically says you can use $_SERVER['HTTP_ACCEPT_LANGUAGE'] [details here] to determine the language. At that point, you'll have to follow the standard Cake procedures to change your app's language based on which language you detect.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.