diff options
author | Andrey Andreev <narf@devilix.net> | 2014-02-08 17:18:33 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-02-08 17:18:33 +0100 |
commit | f733d6db7345ccc5d7ed516fd22ea03cc245cbc4 (patch) | |
tree | 0f5eec61542d5c1142709610f5ccaf3908cf36f5 /user_guide_src/source/libraries/language.rst | |
parent | 93326a5b1bbaade4d416ad17a768cab27337ec5b (diff) | |
parent | 28c2c975b118016d07212ed8e7c22ff280309f82 (diff) |
Merge branch 'feature/user-guide-cleanup' into develop
Diffstat (limited to 'user_guide_src/source/libraries/language.rst')
-rw-r--r-- | user_guide_src/source/libraries/language.rst | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/user_guide_src/source/libraries/language.rst b/user_guide_src/source/libraries/language.rst index d288cd65e..3014d8f09 100644 --- a/user_guide_src/source/libraries/language.rst +++ b/user_guide_src/source/libraries/language.rst @@ -19,11 +19,22 @@ 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 +.. contents:: + :local: + +.. raw:: html + + <div class="custom-index container"></div> + +************************ +Using the Language Class +************************ + Creating Language Files ======================= -Language files must be named with **_lang.php** as the file extension. For -example, let's say you want to create a file containing error messages. +Language files must be named with **_lang.php** as the filename extension. +For example, let's say you want to create a file containing error messages. You might name it: error_lang.php Within the file you will assign each line of text to an array called @@ -79,7 +90,7 @@ Using language lines as form labels ----------------------------------- This feature has been deprecated from the language library and moved to -the :php:func:`lang()` function of the :doc:`Language Helper +the :func:`lang()` function of the :doc:`Language Helper <../helpers/language_helper>`. Auto-loading Languages @@ -89,4 +100,32 @@ If you find that you need a particular language globally throughout your application, you can tell CodeIgniter to :doc:`auto-load <../general/autoloader>` it during system initialization. This is done by opening the **application/config/autoload.php** file and adding the -language(s) to the autoload array.
\ No newline at end of file +language(s) to the autoload array. + +*************** +Class Reference +*************** + +.. class:: CI_Lang + + .. method:: load($langfile[, $idiom = ''[, $return = FALSE[, $add_suffix = TRUE[, $alt_path = '']]]]) + + :param string $langfile: Language file to load + :param string $idiom: Language name (i.e. 'english') + :param bool $return: Whether to return the loaded array of translations + :param bool $add_suffix: Whether to add the '_lang' suffix to the language file name + :param string $alt_path: An alternative path to look in for the language file + :returns: Array of language lines if $return is set to TRUE, otherwise void + :rtype: mixed + + Loads a language file. + + .. method:: line($line[, $log_errors = TRUE]) + + :param string $line: Language line key name + :param bool $log_errors: Whether to log an error if the line isn't found + :returns: Language line string or FALSE on failure + :rtype: string + + Fetches a single translation line from the already loaded language files, + based on the line's name.
\ No newline at end of file |