December 2008 Archives

Giving CGI::Application internationalization (I18N)

Part 3

Lets look at the remaining functions of Catalyst::Plugin::I18N and what they are doing.

sub languages {
    my ( $c, $languages ) = @_; ### Getting the catalyst object and languages to set to it.
    if ($languages) { $c->{languages} = $languages } ### Setting the objects languages property if languages passed in
    else {
        $c->{languages} ||= [
    } ### Otherwise detects users language tags using I18N::LangTags::Detect and make sure all superordinates are included using I18N::LangTags::implicate_supers (if the objects languages property is empty)
    no strict 'refs';
    &{ ref($c) . '::_loc_lang' }( @{ $c->{languages} } ); ### Call Locale::Maketext::Simple's loc_lang function from the calling objects namespace setting the languages
    return $c->{languages};
Giving CGI::Application internationalization (I18N)

Part 2

I should now have the knowledge I need to work my way through the Catalyst::Plugin::I18N module and figure out how they are doing it.

It's first method is 'setup', which is an extension of Catalysts own setup method. I'll look into how plugs work for CGI::App...
It seems that they also have a similar setup method.

Lets look at what the code is doing:-

Giving CGI::Application internationalization (I18N)

Part 1

My project is planned in CGI::Application, I would use Catalyst, DBIx::Class and Moose but don't fancy the learning curve and the weight of the framework. CGI::Application is lightweight and easy to distribute with my software. I've also been working on my own database module, that just makes doing SQL queries a bit easier, rather than trying to apply a full abstraction layer. If I use an object system it'll be Mouse rather than Moose.

I think a lightweight easy to use alternative to the very popular Catalyst - Moose - DBIx::Class is a very good thing. Finally I've got something Perlish to blog about :)

1st Hurdle

I want my project to be language packable. There is no I18N plugin for CGI::App, so it looks like the first things I am going to have to do is create one. I've looked into Internationalization and Localization a few times before, it seems like a total mine field, but now is the time to finally battle through it.

Checking out CPAN

My first Perl blog

| No Comments | No TrackBacks
Hi All,
  It's about time I started a Perl blog. With all the Perl projects I've got going, I'm sure there are plenty of things I could blog about. So here we go...


About this Archive

This page is an archive of entries from December 2008 listed from newest to oldest.

January 2009 is the next archive.

Find recent content on the main index or look in the archives to find all content.