![]() |
change default language at runtime ? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: change default language at runtime ? (/showthread.php?tid=1563) |
change default language at runtime ? - djsuperfive - 03-21-2015 Hi, is it possible to change the default language at runtime and automatically reload all language files that are declared in the autoload property ? thanks. RE: change default language at runtime ? - mwhitney - 03-23-2015 I don't think you can automatically reload the language files, so you have to set the language before the language files are loaded. Otherwise, you could loop through $this->lang->is_loaded to determine which files have been loaded (and reload them with the new language idiom). RE: change default language at runtime ? - CroNiX - 03-23-2015 http://www.codeigniter.com/userguide3/general/hooks.html RE: change default language at runtime ? - djsuperfive - 03-23-2015 (03-23-2015, 07:29 AM)mwhitney Wrote: I don't think you can automatically reload the language files, so you have to set the language before the language files are loaded. Hi, thanks for the answer. Indeed using $this->lang->is_loaded works fine for me. thank you ! RE: change default language at runtime ? - djsuperfive - 03-25-2015 (03-23-2015, 07:29 AM)mwhitney Wrote: I don't think you can automatically reload the language files, so you have to set the language before the language files are loaded. Why is this property not documented ? RE: change default language at runtime ? - Narf - 03-25-2015 Because you're not supposed to use it. Don't. RE: change default language at runtime ? - mwhitney - 03-25-2015 It looks like I'll have to pay a little more attention to the documentation. I wouldn't have mentioned it if it was set as a protected property or marked as deprecated in the code. |