Setting default language in config - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Setting default language in config (/showthread.php?tid=66109) |
Setting default language in config - JackWhite - 09-06-2016 Hello! I'm using the latest CI version. Currently, I'm trying to set up multi language support for my website. In application/config/config.php the default $config['language'] is set to 'english'. It's working as it should, and loads the application/language/english/english_lang.php file. But when I change the $config['language'] to something else, for example, polish, it gives me an error: Unable to load the requested language file: language/polish/english_lang.php Why is it trying to load english_lang.php and not polish_lang.php from the application/language/polish folder? Hope to get some input on this. Best regards. RE: Setting default language in config - ciadmin - 09-06-2016 Have you copied the appropriate language folders from https://github.com/bcit-ci/codeigniter3-translations into your application/language folder? Code: $this->lang->load('error_messages', 'english'); RE: Setting default language in config - JackWhite - 09-06-2016 (09-06-2016, 06:32 AM)ciadmin Wrote: Have you copied the appropriate language folders from https://github.com/bcit-ci/codeigniter3-translations into your application/language folder? When I'm loading the language with your example, everything works fine. The problem is when I set different language than english in the config.php file to use as the default language. When I set $config['language'] = 'polish'; It gives error: Unable to load the requested language file: language/polish/english_lang.php Shouldn't it be loading language/polish/polish_lang.php instead of language/polish/english_lang.php? Sure, I can set my messages for polish language in the language/polish/english_lang.php file, but that doesn't make much sense to me at the moment. RE: Setting default language in config - ciadmin - 09-06-2016 Hmm. something sounds funny, because there is no "english_lang.php" language settings file in CI. If using language "x", CI looks inside system/language/x/ for specific language files, and then inside application/language/x/ RE: Setting default language in config - InsiteFX - 09-06-2016 ciadmin is correct there is no english_lang.php file in CodeIgniter. The only specification is directory english. RE: Setting default language in config - JackWhite - 09-07-2016 Ok, I seem to have figured it out. In autoload.php I had set $autoload['language'] = array('english'); That's why it was trying to load english_lang.php. Thanks for your input guys! |