From 114ab0988e20ac6be39ad363ff897a1a3b85e565 Mon Sep 17 00:00:00 2001 From: Razican Date: Mon, 25 Apr 2011 17:26:45 +0200 Subject: Fixed double-space typo. --- user_guide/libraries/language.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'user_guide/libraries/language.html') diff --git a/user_guide/libraries/language.html b/user_guide/libraries/language.html index 75863c2ac..1b253fa00 100644 --- a/user_guide/libraries/language.html +++ b/user_guide/libraries/language.html @@ -60,30 +60,30 @@ 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'll find one called language containing sets of language files. You can create +

In your CodeIgniter system folder you'll find one called language 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.

-

Language files are typically stored in your system/language directory. Alternately you can create a folder called language inside -your application folder and store them there. CodeIgniter will look first in your application/language -directory. If the directory does not exist or the specified language is not located there CI will instead look in your global +

Language files are typically stored in your system/language directory. Alternately you can create a folder called language inside +your application folder and store them there. CodeIgniter will look first in your application/language +directory. If the directory does not exist or the specified language is not located there CI will instead look in your global system/language folder.

-

Note:  Each language should be stored in its own folder. For example, the English files are located at: +

Note:  Each language should be stored in its own folder. For example, the English files are located at: system/language/english

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. You might name it: error_lang.php

+

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. You might name it: error_lang.php

Within the file you will assign each line of text to an array called $lang with this prototype:

$lang['language_key'] = "The actual message to be shown";

Note: 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 error_

+similarly named items in other files. For example, if you are creating error messages you might prefix them with error_

$lang['error_email_missing'] = "You must submit an email address";
$lang['error_url_missing'] = "You must submit a URL";
@@ -92,12 +92,12 @@ $lang['error_username_missing'] = "You must submit a username";
Loading A Language File -

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:

+

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:

$this->lang->load('filename', 'language');

Where filename is the name of the file you wish to load (without the file extension), and language -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 application/config/config.php file will be used.

@@ -109,7 +109,7 @@ is the language set containing it (ie, english). If the second parameter is mis

Where language_key is the array key corresponding to the line you wish to show.

-

Note: This function simply returns the line. It does not echo it for you.

+

Note: This function simply returns the line. It does not echo it for you.

Using language lines as form labels

-- cgit v1.2.3-24-g4f1b