![]() |
A simple Internationalization (i18n) library for CodeIgniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: A simple Internationalization (i18n) library for CodeIgniter (/showthread.php?tid=47614) |
A simple Internationalization (i18n) library for CodeIgniter - El Forum - 12-15-2011 [eluser]appleboy[/eluser] For download or recent update, look at [url="https://github.com/appleboy/CodeIgniter-i18n"]CodeIgniter-i18n @ GitHub[/url] Requirement CodeIgniter 2.1.X Enable Session What it does Have the language field in the URL, exapmle: Code: ?lang=en-us Installation copy application/config/language.php to your_app/application/config/ copy application/core/MY_Lang.php to your_app/application/core/ Code: $ cp application/config/language.php our_app/application/config/ Configuration Open application/config/language.php file language_field You can find this field in URL, default value is "lang", example: ?lang=zh-tw language_default_key Default language you want to output. language_list The language array lists you can support. key: defined from $_['HTTP_ACCEPT_LANGUAGE'] value: corresponding to your language folder. How to use application/language/english/about_lang.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); View Code: <p><?php echo lang('about.home')?></p> The language class will add prefix value on all language array key automatically. example: Code: about_lang.php => key: about.xxxx |