diff options
Diffstat (limited to 'user_guide_src')
-rw-r--r-- | user_guide_src/source/libraries/language.rst | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/user_guide_src/source/libraries/language.rst b/user_guide_src/source/libraries/language.rst index c3f9b6d5a..e833d9757 100644 --- a/user_guide_src/source/libraries/language.rst +++ b/user_guide_src/source/libraries/language.rst @@ -5,26 +5,25 @@ Language Class The Language Class provides functions to retrieve language files and lines of text for purposes of internationalization. -In your CodeIgniter **system** folder, you will find a **language** -subfolder containing a set of language files for the **english** idiom. -The files in this folder (**system/language/english/**) define the regular messages, +In your CodeIgniter **system** folder, you will find a **language** sub-directory +containing a set of language files for the **english** idiom. +The files in this directory (**system/language/english/**) define the regular messages, error messages, and other generally output terms or expressions, for the different parts -of the CodeIgniter core framework. +of the CodeIgniter framework. -You can create or incorporate your own language -files, as needed, in order to provide application-specific error and other messages, -or to provide translations of the core messages into other languages. -These translations or additional messages would go inside your application/language folder, -with separate subfolders for each idiom (for instance french or german). +You can create or incorporate your own language files, as needed, in order to provide +application-specific error and other messages, or to provide translations of the core +messages into other languages. These translations or additional messages would go inside +your **application/language/** directory, with separate sub-directories for each idiom +(for instance, 'french' or 'german'). The CodeIgniter framework comes with a set of language files for the "english" idiom. -Additional approved translations for different idioms may be found in the +Additional approved translations for different idioms may be found in the `CodeIgniter 3 Translations repositories <https://github.com/codeigniter3-translations>`_. Each repository deals with a single idiom. -When CodeIgniter loads language files, it will load the -one in **system/language/** first and will then look for an override in -your **application/language/** directory. +When CodeIgniter loads language files, it will load the one in **system/language/** +first and will then look for an override in your **application/language/** directory. .. note:: Each language should be stored in its own folder. For example, the English files are located at: system/language/english @@ -41,7 +40,7 @@ Handling Multiple Languages *************************** If you want to support multiple languages in your application, you would provide folders inside -your **application/language/** directory for each of them, and you would specify the default +your **application/language/** directory for each of them, and you would specify the default language in your **application/config/config.php**. The **application/language/english/** directory would contain any additional language files @@ -58,45 +57,46 @@ Sample Language Files :: - system/ - language/ - english/ - ... - email_lang.php - form_validation_lang.php - ... - - application/ - language/ - english/ - error_messages_lang.php - french/ - ... - email_lang.php - error_messages_lang.php - form_validation_lang.php - ... + system/ + language/ + english/ + ... + email_lang.php + form_validation_lang.php + ... + + application/ + language/ + english/ + error_messages_lang.php + french/ + ... + email_lang.php + error_messages_lang.php + form_validation_lang.php + ... Example of switching languages ============================== :: - $idiom = $this->session->get_userdata('language'); - $this->lang->load('error_messages',$idiom); - $oops = $this->lang->line('nessage_key'); + $idiom = $this->session->get_userdata('language'); + $this->lang->load('error_messages', $idiom); + $oops = $this->lang->line('message_key'); ******************** Internationalization ******************** -The Language class in CodeIgniter is meant to provide an easy and lightweight way to support multiple -languages in your application. It is not meant to be a full implementation of what is commonly called -`internationalization and localization <http://en.wikipedia.org/wiki/Internationalization_and_localization>`_. +The Language class in CodeIgniter is meant to provide an easy and lightweight +way to support multiplelanguages in your application. It is not meant to be a +full implementation of what is commonly called `internationalization and localization +<http://en.wikipedia.org/wiki/Internationalization_and_localization>`_. -We use the term "idiom" to refer to a language using its common name, -rather than using any of the international standards, such as "en", "en-US", or "en-CA-x-ca" for English -and some of its variants. +We use the term "idiom" to refer to a language using its common name, +rather than using any of the international standards, such as "en", "en-US", +or "en-CA-x-ca" for English and some of its variants. .. note:: There is nothing to prevent you from using those abbreviations in your application! |