X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=lib%2FPackages%2FI18N%2FLocale.pm;h=c65c9b70d3f6a6f5ed7dab8bdf4349adae91e8a5;hb=23c6dbb18b991ee31b04a032c3168e13cfdefd19;hp=94fd8990fdf8013f981e67b1b8ba437fec9e4bc2;hpb=1b69eafb0f33afa134e3a0c0c794c72cbaf37294;p=deb%2Fpackages.git diff --git a/lib/Packages/I18N/Locale.pm b/lib/Packages/I18N/Locale.pm index 94fd899..c65c9b7 100644 --- a/lib/Packages/I18N/Locale.pm +++ b/lib/Packages/I18N/Locale.pm @@ -4,25 +4,37 @@ use strict; use warnings; use base 'Locale::Maketext'; -use Locale::Maketext::Lexicon { - '*' => [Gettext => '/home/djpig/debian/www.d.o/packages/po/pdo.*.po', - Gettext => '/home/djpig/debian/www.d.o/packages/po/templates.*.po', - Gettext => '/home/djpig/debian/www.d.o/packages/po/langs.*.po'], - _auto => 1, - _style => 'gettext', -}; +use Locale::Maketext::Lexicon; use base 'Exporter'; -our @EXPORT = qw( _g N_ ); +our @EXPORT = qw( N_ ); + +sub load { + my ($podir) = @_; + + Locale::Maketext::Lexicon->import( { + 'en' => [Gettext => "$podir/pdo.pot", + Gettext => "$podir/templates.pot", + Gettext => "$podir/langs.pot", + Gettext => "$podir/sections.pot", + Gettext => "$podir/debtags.pot"], + '*' => [Gettext => "$podir/pdo.*.po", + Gettext => "$podir/templates.*.po", + Gettext => "$podir/langs.*.po", + Gettext => "$podir/sections.*.po", + Gettext => "$podir/debtags.*.po"], + _auto => 1, + _style => 'gettext', + } ); +} -sub _g { return $_[0]; } sub N_ { return $_[0]; } sub g { my ($self, $format, @args) = @_; my $result = $self->maketext($format, @args); - return sprintf($result, @args) if $result =~ /%[su]/; + return sprintf($result, @args) if $result =~ /%([su]|[.\d]*f)/; return $result; }