Let's say I have this in my bootstrap.php file in a cakePHP application:
Configure::write('Config.language', 'eng');
How can I dynamically change the value of that configuration variable based on user action in a controller of my application? I tried to do the same thing that I did above here in my controller, but that didn't work
Any help?
Try Configure::write('Config.language', 'dut');
for eg
This answer from the question suggested by @Ryan Pendleton shows a somewhat correct way to use this directive. It should be used in the AppController because it gets loaded first - as the parent of all other controllers in the application itself. I used "somewhat correct" because it is best to validate the language codes ('eng', 'fre', 'dut') in the app/config/routes.php
file - go here for more information .
Also do check out this: Internationalization-Localization explanation .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.