From: Frank Lichtenheld Date: Sat, 17 Nov 2007 17:05:27 +0000 (+0100) Subject: Make the po location configurable X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=58039945e72bbba9d7395e78df27f028479f00d3;p=deb%2Fpackages.git Make the po location configurable --- diff --git a/bin/create_index_pages b/bin/create_index_pages index 6dd32a3..6d08d60 100755 --- a/bin/create_index_pages +++ b/bin/create_index_pages @@ -20,6 +20,7 @@ use Packages::Page; use Packages::SrcPage; use Packages::Sections; &Packages::Config::init( './' ); +&Packages::I18N::Locale::load( "$TOPDIR/po" ); my $wwwdir = "$TOPDIR/www"; diff --git a/bin/parse-debtags-voc b/bin/parse-debtags-voc index 4fd49f9..be25178 100755 --- a/bin/parse-debtags-voc +++ b/bin/parse-debtags-voc @@ -34,6 +34,7 @@ use Packages::Template; use Packages::Config qw( $TOPDIR @LANGUAGES ); use Packages::I18N::Locale; &Packages::Config::init( './' ); +&Packages::I18N::Locale::load( "$TOPDIR/po" ); my $debtagsdir = "$TOPDIR/files/debtags"; my $wwwdir = "$TOPDIR/www/about"; my $voc_file = "$debtagsdir/vocabulary"; diff --git a/lib/Packages/Dispatcher.pm b/lib/Packages/Dispatcher.pm index 4d5e16e..9d80f68 100755 --- a/lib/Packages/Dispatcher.pm +++ b/lib/Packages/Dispatcher.pm @@ -91,6 +91,7 @@ sub do_dispatch { my $homedir = dirname($ENV{SCRIPT_FILENAME}).'/../'; &Packages::Config::init( $homedir ); &Packages::DB::init(); + &Packages::I18N::Locale::load( "$homedir/po" ); my $acc = I18N::AcceptLanguage->new(); my %all_langs = map { $_ => 1 } (@LANGUAGES, @DDTP_LANGUAGES); diff --git a/lib/Packages/DoDownload.pm b/lib/Packages/DoDownload.pm index 566195a..d999b9a 100644 --- a/lib/Packages/DoDownload.pm +++ b/lib/Packages/DoDownload.pm @@ -10,7 +10,6 @@ use Benchmark ':hireswallclock'; use Exporter; use Deb::Versions; -use Packages::I18N::Locale; use Packages::Search qw( :all ); use Packages::Config qw( $DBDIR @SUITES @ARCHIVES @SECTIONS @ARCHITECTURES ); use Packages::CGI; diff --git a/lib/Packages/DoFilelist.pm b/lib/Packages/DoFilelist.pm index 188cfb8..ee092e3 100644 --- a/lib/Packages/DoFilelist.pm +++ b/lib/Packages/DoFilelist.pm @@ -10,7 +10,6 @@ use Exporter; use Deb::Versions; use Packages::Config qw( $DBDIR $ROOT @SUITES @ARCHIVES @SECTIONS @ARCHITECTURES %FTP_SITES ); -use Packages::I18N::Locale; use Packages::CGI; use Packages::DB; use Packages::Search qw( :all ); diff --git a/lib/Packages/DoIndex.pm b/lib/Packages/DoIndex.pm index 164e594..a0cae2b 100644 --- a/lib/Packages/DoIndex.pm +++ b/lib/Packages/DoIndex.pm @@ -8,7 +8,6 @@ use Exporter; use Deb::Versions; use Packages::Config qw( $TOPDIR ); -use Packages::I18N::Locale; use Packages::CGI; our @ISA = qw( Exporter ); diff --git a/lib/Packages/DoNewPkg.pm b/lib/Packages/DoNewPkg.pm index 66a0bfe..4496089 100644 --- a/lib/Packages/DoNewPkg.pm +++ b/lib/Packages/DoNewPkg.pm @@ -9,7 +9,6 @@ use Exporter; our @ISA = qw( Exporter ); our @EXPORT = qw( do_newpkg ); -use Packages::I18N::Locale; use Packages::Search qw( :all ); use Packages::CGI; use Packages::DB; diff --git a/lib/Packages/DoSearch.pm b/lib/Packages/DoSearch.pm index 1aa67f1..9fa8d3d 100644 --- a/lib/Packages/DoSearch.pm +++ b/lib/Packages/DoSearch.pm @@ -10,7 +10,6 @@ our @ISA = qw( Exporter ); our @EXPORT = qw( do_search ); use Deb::Versions; -use Packages::I18N::Locale; use Packages::Search qw( :all ); use Packages::CGI qw( :DEFAULT ); use Packages::DB; diff --git a/lib/Packages/DoShow.pm b/lib/Packages/DoShow.pm index 5d6174c..1d41c3a 100644 --- a/lib/Packages/DoShow.pm +++ b/lib/Packages/DoShow.pm @@ -14,7 +14,6 @@ use Deb::Versions; use Packages::Config qw( $DBDIR @SUITES @ARCHIVES @SECTIONS @ARCHITECTURES %FTP_SITES @LANGUAGES @DDTP_LANGUAGES); -use Packages::I18N::Locale; use Packages::CGI qw( :DEFAULT make_url make_search_url ); use Packages::DB; use Packages::Search qw( :all ); diff --git a/lib/Packages/I18N/Locale.pm b/lib/Packages/I18N/Locale.pm index 3b4ecc6..c65c9b7 100644 --- a/lib/Packages/I18N/Locale.pm +++ b/lib/Packages/I18N/Locale.pm @@ -4,25 +4,31 @@ use strict; use warnings; use base 'Locale::Maketext'; -use Locale::Maketext::Lexicon { - 'en' => [Gettext => '/home/djpig/debian/www.d.o/packages/po/pdo.pot', - Gettext => '/home/djpig/debian/www.d.o/packages/po/templates.pot', - Gettext => '/home/djpig/debian/www.d.o/packages/po/langs.pot', - Gettext => '/home/djpig/debian/www.d.o/packages/po/sections.pot', - Gettext => '/home/djpig/debian/www.d.o/packages/po/debtags.pot'], - '*' => [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', - Gettext => '/home/djpig/debian/www.d.o/packages/po/sections.*.po', - Gettext => '/home/djpig/debian/www.d.o/packages/po/debtags.*.po'], - _auto => 1, - _style => 'gettext', -}; +use Locale::Maketext::Lexicon; use base 'Exporter'; 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 N_ { return $_[0]; } sub g {