blob: 1911e3bfd4f1bbe5c4deb6c0cb17221819cfded6 [file] [log] [blame]
Derek Jones8ede1a22011-10-05 13:34:52 -05001###############
2Language Helper
3###############
4
5The Language Helper file contains functions that assist in working with
6language files.
7
8.. contents:: Page Contents
9
10Loading this Helper
11===================
12
Andrey Andreev53b8ef52012-11-08 21:38:53 +020013This helper is loaded using the following code::
Derek Jones8ede1a22011-10-05 13:34:52 -050014
15 $this->load->helper('language');
16
17The following functions are available:
18
Andrey Andreev53b8ef52012-11-08 21:38:53 +020019lang()
20======
21
Andrey Andreev3b407062012-11-26 23:55:37 +020022.. php:function:: lang($line, $for = '', $attributes = array())
Andrey Andreev53b8ef52012-11-08 21:38:53 +020023
24 :param string $line: Language line key
Andrey Andreev3b407062012-11-26 23:55:37 +020025 :param string $for: HTML "for" attribute (ID of the element we're creating a label for)
26 :param array $attributes: Any additional HTML attributes
Andrey Andreev53b8ef52012-11-08 21:38:53 +020027 :returns: string
Derek Jones8ede1a22011-10-05 13:34:52 -050028
29This function returns a line of text from a loaded language file with
Andrey Andreev53b8ef52012-11-08 21:38:53 +020030simplified syntax that may be more desirable for view files than
31``CI_Lang::line()``.
Derek Jones8ede1a22011-10-05 13:34:52 -050032
Andrey Andreev53b8ef52012-11-08 21:38:53 +020033Example::
Derek Jones8ede1a22011-10-05 13:34:52 -050034
Andrey Andreev3b407062012-11-26 23:55:37 +020035 echo lang('language_key', 'form_item_id', array('class' => 'myClass');
36 // Outputs: <label for="form_item_id" class="myClass">Language line</label>