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} ||= [
I18N::LangTags::implicate_supers(
I18N::LangTags::Detect->http_accept_langs(
$c->request->header('Accept-Language')
)
),
'i-default'
];
} ### 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};
}