O Guia Definitivo do Yii 1.1
O Guia Definitivo do Yii 1.1
O Guia Definitivo do Yii 1.1
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Yii</strong>::t('app', '{n} cucumber|{n} cucumbers', 62);<br />
<strong>Yii</strong>::t('app', '{n} cucumber|{n} cucumbers', 1.5);<br />
<strong>Yii</strong>::t('app', '{n} cucumber|{n} cucumbers', 1);<br />
<strong>Yii</strong>::t('app', '{n} cucumber|{n} cucumbers', 7);<br />
with translated message<br />
'{n} cucumber|{n} cucumbers' => '{n} огурец|{n} огурца|{n} огурцов|{n}<br />
огурца',<br />
and will give you<br />
62 огурца<br />
1.5 огурца<br />
1 огурец<br />
7 огурцов<br />
Info: to learn about how many values you should supply and in which order they<br />
should be, please refer to CLDR Language Plural Rules page.<br />
File Translation<br />
File translation is accomplished by calling CApplication::findLocalizedFile(). Given the path<br />
of a file to be translated, the method will look for a file with the same name under the<br />
LocaleID subdirectory. If found, the file path will be returned; otherwise, the original file<br />
path will be returned.<br />
File translation is mainly used when rendering a view. When calling one of the render<br />
methods in a controller or widget, the view files will be translated automatically. For<br />
example, if the target language is zh_cn while the source language is en_us, rendering a<br />
view named edit would resulting in searching for the view file protected/views/ControllerID/<br />
zh_cn/edit.php. If the file is found, this translated version will be used for rendering;<br />
otherwise, the file protected/views/ControllerID/edit.php will be rendered instead.<br />
File translation may also be used for other purposes, for example, displaying a translated<br />
image or loading a locale-dependent data file.<br />
Date and Time Formatting<br />
Date and time are often in different formats in different countries or regions. The task of<br />
date and time formatting is thus to generate a date or time string that fits for the specified<br />
locale. <strong>Yii</strong> providesCDateFormatter for this purpose.<br />
Each CDateFormatter instance is associated with a target locale. To get the formatter<br />
associated with the target locale of the whole application, we can simply access the<br />
dateFormatter property of the application.