diff --git a/application/core/MY_Lang.php b/application/core/MY_Lang.php index bede557..d13f71d 100644 --- a/application/core/MY_Lang.php +++ b/application/core/MY_Lang.php @@ -7,11 +7,47 @@ */ class MY_Lang extends CI_Lang { + var $_gettext_language; + var $_gettext_domain; + var $_gettext_path; + /** * Calls the parent constructor. */ public function __construct() { parent::__construct(); + $this->_gettext_domain = 'lang'; + log_message('debug', "Gettext Class Initialized"); + + $this->load_gettext(); + } + + /** + * This method overides the original load method. It's duty is loading the + * domain files by config or by default internal settings. + * + * @param string $user_lang + */ + public function load_gettext($user_lang = false) { + if ($user_lang) { + $this->_gettext_language = $user_lang; + } else { + $this->_gettext_language = 'en_EN'; + } + log_message('debug', 'The gettext language was set by parameter: ' . $this->_gettext_language); + + putenv("LANG=$this->_gettext_language"); + setlocale(LC_ALL, $this->_gettext_language); + + // set the path of .po files + $this->_gettext_path = APPPATH . 'language/locale'; + log_message('debug', 'Gettext Class path chosen is: ' . $this->_gettext_path); + + bindtextdomain($this->_gettext_domain, $this->_gettext_path); + textdomain($this->_gettext_domain); + log_message('debug', 'The gettext domain chosen is: '. $this->_gettext_domain); + + return true; } /** diff --git a/application/language/locale/en_EN/LC_MESSAGES/lang.po b/application/language/locale/en_EN/LC_MESSAGES/lang.po new file mode 100644 index 0000000..dfd678f --- /dev/null +++ b/application/language/locale/en_EN/LC_MESSAGES/lang.po @@ -0,0 +1,53 @@ +msgid "users" +msgstr "Users" + +msgid "available_users" +msgstr "Available users" + +msgid "username" +msgstr "Username" + +msgid "realname" +msgstr "Name" + +msgid "options" +msgstr "Options" + +msgid "user_edit" +msgstr "Edit" + +msgid "user_create" +msgstr "Create new user" + +msgid "user_delete" +msgstr "Delete" + +msgid "create_user" +msgstr "Create a new user" + +msgid "edit_user" +msgstr "Edit user" + +msgid "field_username" +msgstr "Username" + +msgid "field_password" +msgstr "Password" + +msgid "field_password_confirm" +msgstr "Confirm password" + +msgid "field_firstname" +msgstr "First name" + +msgid "field_lastname" +msgstr "Last name" + +msgid "field_email" +msgstr "Email address" + +msgid "field_institution" +msgstr "Institution" + +msgid "field_phone" +msgstr "Phone number" diff --git a/application/views/admin/users/index.php b/application/views/admin/users/index.php index 2ff968b..9857848 100644 --- a/application/views/admin/users/index.php +++ b/application/views/admin/users/index.php @@ -3,7 +3,7 @@