[Solar-talk] I18N question

Antti Holvikari anttih at gmail.com
Mon Jan 21 11:41:11 CST 2008


On Jan 21, 2008 7:29 PM, Tobias Nix <tobias.nix at paupau.org> wrote:
> Hello,
>
>
> Do not know, but you can set a language like this:
>
> Solar::start('config.php');
>
> Solar_Registry::get('locale')->setCode('de_DE');

You can also set this in config file with

$config['Solar_Locale']['code'] = 'de_DE';

> > How does Solar choose a local file to display, is it based of the request
> > headers of the browser?

Solar doesn't auto-detect locale from request headers. You need to set
the content-type in a meta tag so that the clients browser knows what
encoding to use.

So to generate this:

<meta http-equiv="Content-Type" content="charset=utf-8" />

...you can do this for example in your _head layout template:

        // set encoding to UTF-8
        $this->layout_head['meta'][] = array(
            'http-equiv' => 'Content-Type',
            'content'    => 'charset=utf-8',
        );

Ofcourse, you can just paste that to your code if you don't want to
use the layout_head variable for this :-D

Ps. remember to tell your database to use UTF-8 as it's encoding when
you make queries.

Hope that helps.

-- 
Antti Holvikari


More information about the Solar-talk mailing list