Kohana i18n in Fuel

Kohana::i18n == Fuel::Core::Lang

Getting your Kohana i18n stuff migrated to Fuel is actually very easy.

First of all copy your old language translation file into lang/[countrycode], for example: lang/de/german_signup.php

In the general config (config/config.php) you have to set the language, which determines in which of the directories under ‘lang’ Fuel will look for the file. e.g. ‘language’  => ‘de’.

Then you have to load this somewhere using Lang::Load(‘[filename]‘);, for example Lang::Load(‘german_signup.php’);

In this particular Project I’ve put it within the before() function of my Base Controller, that way i don’t have to worry about it.
Right now i don’t see any sense in having a separate language file for each controller, because of this i can load it within the base controller of everything. Who knows, maybe i’ll change my mind about this later, but not just yet.

To Load  a string:
I18n::get(‘firstlevel.secondlevel’);
becomes
Lang::line(‘firstlevel.secondlevel’);

That’s pretty much it. easy huh? :)

Getting started with Fuel

So,
I’ve been working with the Kohana Php Framework for a while now, and even though i really like it, I’m getting a little bit tired of having to run Migrations with every new minor release due to backwards incompatible changes they keep making.

Because of that i’ve been looking into the Fuel Php Framework a bit and so far i like what i see. So i’m going to try and port my current Webapp over to Fuel and try to document the process of this right here. Assuming that i find enough time to complete that Task and that i won’t get tired of writing it all down, this might be a useful resource for anyone trying to get started with Fuel.

Well then, lets see how this goes.