Hello!
Where could I find more information about using Internationalization (I18N)?
I got confused about some classes calls like (CLocale)
Thanks!
Hello!
Where could I find more information about using Internationalization (I18N)?
I got confused about some classes calls like (CLocale)
Thanks!
What kind of examples are you expecting?
my current project using YII is writed in portugues, but users of the system use: spanish english and portugues, how is the standard to work in this case
also where I can change the source language
pt_BR example ? is in the configuration file?
‘language’,array(‘pt_BR’),
and the spected language
localhost/index.php?r=/pt/
regards
This has nothing to do with CLocale. You need to set 'sourceLanguage' to be 'pt' in app config. You can set 'language' in init() of base controller class depending on GET parameter or user cookie setting.
@qiang : All my forms and datagrids show unformatted numeric and date, I want them to be formated, how can I achieved that using locale ?
-majin-
First get the date formatter corresponding to the currently used locale (determined by 'language' property):
$dateFormatter=Yii::app()->dateFormatter;
Then check CDateFormatter API documentation on how to make use of the formatter.
Number formatter can be used similarly.
@giang : I tried in one of the form and it works ! since my application have many date and numeric field spread all over in many forms and list, so I think it will be much efficient and easy to manage if I store all formatter in one file. The problem is I'm not sure how to make it centralize, could you please give some hints ?
Thks
-majin-
You could create some global functions for this purpose. They return the needed formatter. You then include these global functions in your entry script file.