Retrive lang string from URI Language Identifier - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Retrive lang string from URI Language Identifier (/showthread.php?tid=59582) |
Retrive lang string from URI Language Identifier - El Forum - 10-23-2013 [eluser]John-Doe[/eluser] Hello, Im using URI Language Identifier (https://github.com/EllisLab/CodeIgniter/wiki/URI-Language-Identifier). I have set up so the URL changes right, like following: http://example.com/fi/test http://example.com/en/test http://example.com/de/test The following is in my config file: Code: $config['language'] = 'english'; In application/core I have the file MY_Lang.php with the code: https://github.com/EllisLab/CodeIgniter/wiki/URI-Language-Identifier (application/core/MY_Lang.php) But how should I retrive the "fi", "en" or "de" param? I have tried the following - which is stated on the GITHUB page - in my controller: Use the $config['language'] value or $config['lang_abbr'] to determine the active language when loading your application or module. With the above codes I get: Code: Severity: Notice I have also tried $this->config->item('lang_uri_abbr'); which is stated in this Stackoverflow thread: http://stackoverflow.com/questions/13237051/how-can-enable-users-switching-between-languages-with-uri-language-identifier This generates an array with all the short codes for the language, but not the active language. How do I retrieve the language param? Retrive lang string from URI Language Identifier - El Forum - 10-24-2013 [eluser]John-Doe[/eluser] I went with this as a solution instead: https://github.com/EllisLab/CodeIgniter/wiki/CodeIgniter-2.1-internationalization-i18n Works flawless! |