tags:

views:

165

answers:

3

In the following tutorial: http://pinoytech.org/blog/post/Kohana-2.4-I18N-internationalization-and-localization-Library the author says:

I'd put it in a Base Controller so that all Controllers inherit it.

this is the code:

I18n::set_locale('tl_PH');

I tried placing it in all the controller and places I could but is not working.

Which is the exact place where I should place it?

A: 

Not sure who wrote that article, but locale should be set using the config locale.php config file. You may have to copy it from system/config/locale.php into your application/config/locale.php and set the proper values.

Calling I18n::set_locale() should only happen if you need to change from the default (set in locale.php) to something different (like Dutch, English, etc...).

P.S I'm a Kohana 2.4 core dev...

Ixmatus
@Ixmatus sorry but there's isn't any locale.php file (Kohana 3.0.4.2)
janoChen
+1  A: 

Put this line in bootstrap.php:

I18n::lang('tl-PH');

The I18n::set_locale function doesn't exist in Kohana 3. See I18n class docs.

dusan
A: 

If you want to set the PHP locale, you will change this is in application/bootstrap.php, there is a setlocale(LC_ALL, 'en_US.utf-8') line there already which you can change to the correct language.

To set Kohana's internal language for translation, add a call to I18n::lang('en-us') (replace "en-us" with your language) after the Kohana::init() call, before Route::set().

shadowhand

related questions