Subject: | Give a way to return an ISO 639-1 language code instead of i_default |
I need to set the locale of a DateTime object:
my $dt = new DateTime;
$date->set_locale($lang);
If $lang was assigned from $c->language, the previous code won't work
because DateTime can't deal with the locale 'i_default'. I had to
explicitly set $lang to the default lang with:
$lang = $c->languages->[0] if $lang eq 'i_default';
This is (slightly) tedious and it would be useful to have a method to
get the corresponding ISO 639-1 language code automatically instead of
i_default.