diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-05-08 17:23:36 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-05-08 17:23:36 +0200 |
commit | 0854d91fd2848266ec37a37c8a1ccfd13a8a4eda (patch) | |
tree | 1433f1db86920fae6e6286c6cc517ba64cda2aba /user_guide/libraries/language.html | |
parent | 0cb8c59f91567af9aa6530f8764abafe1ae935c0 (diff) | |
parent | 3ef65bd7491f847fecdab1acc9687f0e90eee09b (diff) |
Merged tip.
Diffstat (limited to 'user_guide/libraries/language.html')
-rw-r--r-- | user_guide/libraries/language.html | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/user_guide/libraries/language.html b/user_guide/libraries/language.html index fcc28262d..1b253fa00 100644 --- a/user_guide/libraries/language.html +++ b/user_guide/libraries/language.html @@ -28,7 +28,7 @@ <div id="masthead"> <table cellpadding="0" cellspacing="0" border="0" style="width:100%"> <tr> -<td><h1>CodeIgniter User Guide Version 2.0.1</h1></td> +<td><h1>CodeIgniter User Guide Version 2.0.2</h1></td> <td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td> </tr> </table> @@ -60,30 +60,30 @@ Language Class <p>The Language Class provides functions to retrieve language files and lines of text for purposes of internationalization.</p> -<p>In your CodeIgniter system folder you'll find one called <dfn>language</dfn> containing sets of language files. You can create +<p>In your CodeIgniter system folder you'll find one called <dfn>language</dfn> containing sets of language files. You can create your own language files as needed in order to display error and other messages in other languages.</p> -<p>Language files are typically stored in your <dfn>system/language</dfn> directory. Alternately you can create a folder called <kbd>language</kbd> inside -your <kbd>application</kbd> folder and store them there. CodeIgniter will look first in your <dfn>application/language</dfn> -directory. If the directory does not exist or the specified language is not located there CI will instead look in your global +<p>Language files are typically stored in your <dfn>system/language</dfn> directory. Alternately you can create a folder called <kbd>language</kbd> inside +your <kbd>application</kbd> folder and store them there. CodeIgniter will look first in your <dfn>application/language</dfn> +directory. If the directory does not exist or the specified language is not located there CI will instead look in your global <dfn>system/language</dfn> folder.</p> -<p class="important"><strong>Note:</strong> Each language should be stored in its own folder. For example, the English files are located at: +<p class="important"><strong>Note:</strong> Each language should be stored in its own folder. For example, the English files are located at: <dfn>system/language/english</dfn></p> <h2>Creating Language Files</h2> -<p>Language files must be named with <kbd>_lang.php</kbd> as the file extension. For example, let's say you want to create a file -containing error messages. You might name it: <kbd>error_lang.php</kbd></p> +<p>Language files must be named with <kbd>_lang.php</kbd> as the file extension. For example, let's say you want to create a file +containing error messages. You might name it: <kbd>error_lang.php</kbd></p> <p>Within the file you will assign each line of text to an array called <var>$lang</var> with this prototype:</p> <code>$lang['language_key'] = "The actual message to be shown";</code> <p><strong>Note:</strong> It's a good practice to use a common prefix for all messages in a given file to avoid collisions with -similarly named items in other files. For example, if you are creating error messages you might prefix them with <var>error_</var></p> +similarly named items in other files. For example, if you are creating error messages you might prefix them with <var>error_</var></p> <code>$lang['<var>error</var>_email_missing'] = "You must submit an email address";<br /> $lang['<var>error</var>_url_missing'] = "You must submit a URL";<br /> @@ -92,12 +92,12 @@ $lang['<var>error</var>_username_missing'] = "You must submit a username";</code <h2>Loading A Language File</h2> -<p>In order to fetch a line from a particular file you must load the file first. Loading a language file is done with the following code:</p> +<p>In order to fetch a line from a particular file you must load the file first. Loading a language file is done with the following code:</p> <code>$this->lang->load('<samp>filename</samp>', '<dfn>language</dfn>');</code> <p>Where <samp>filename</samp> is the name of the file you wish to load (without the file extension), and <dfn>language</dfn> -is the language set containing it (ie, english). If the second parameter is missing, the default language set in your +is the language set containing it (ie, english). If the second parameter is missing, the default language set in your <kbd>application/config/config.php</kbd> file will be used.</p> @@ -109,7 +109,7 @@ is the language set containing it (ie, english). If the second parameter is mis <p>Where <samp>language_key</samp> is the array key corresponding to the line you wish to show.</p> -<p>Note: This function simply returns the line. It does not echo it for you.</p> +<p>Note: This function simply returns the line. It does not echo it for you.</p> <h3>Using language lines as form labels</h3> |