X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=bin%2Fcreate_index_pages;h=9beac92d98d3b6fcb6c95f8090929f6aba670561;hb=e454ca3e9cd32ded30b5ee29302119ccd28d71ee;hp=30962ea8653bef1dc4ab969ca8c77ad5b14bc5c9;hpb=11fd4b5f87f668eeb33922c6f64823e40828d137;p=deb%2Fpackages.git diff --git a/bin/create_index_pages b/bin/create_index_pages index 30962ea..9beac92 100755 --- a/bin/create_index_pages +++ b/bin/create_index_pages @@ -28,6 +28,7 @@ delete $ENV{'LC_ALL'}; delete $ENV{'LC_MESSAGES'}; bindtextdomain ( 'pdo', $LOCALES ); bindtextdomain ( 'sections', $LOCALES ); +bindtextdomain ( 'templates', $LOCALES ); textdomain( 'pdo' ); my $wwwdir = "$TOPDIR/www"; @@ -49,9 +50,17 @@ my $priorities = retrieve "$DBDIR/priorities.info"; #use Data::Dumper; #print STDERR Dumper($sections, $subsections, $priorities); -my (%pages); +my (%pages, %tt_vars); -my $template = new Packages::Template( "$TOPDIR/templates", 'html', {} ); +$tt_vars{make_search_url} = sub { return &Packages::CGI::make_search_url(@_) }; +$tt_vars{make_url} = sub { return &Packages::CGI::make_url(@_) }; +$tt_vars{g} = sub { return &Packages::I18N::Locale::tt_gettext(@_) }; +# needed to work around the limitations of the the FILTER syntax +$tt_vars{html_encode} = sub { return HTML::Entities::encode_entities(@_,'<>&"') }; +$tt_vars{uri_escape} = sub { return URI::Escape::uri_escape(@_) }; +$tt_vars{quotemeta} = sub { return quotemeta($_[0]) }; + +my $template = new Packages::Template( "$TOPDIR/templates", 'html', \%tt_vars ); print "write suite index files ...\n"; foreach my $s (@SUITES) { @@ -60,7 +69,7 @@ foreach my $s (@SUITES) { mkpath ( "$wwwdir/source/$key" ); foreach my $lang (@LANGUAGES) { my $locale = get_locale( $lang ); - my $charset = get_locale( $lang ); + my $charset = get_charset( $lang ); setlocale ( LC_ALL, $locale ) or do { warn "couldn't set locale ($lang/$locale)\n"; next; @@ -70,13 +79,6 @@ foreach my $s (@SUITES) { my %content = ( subsections => [], suite => $s, lang => $lang, charset => $charset, used_langs => \@LANGUAGES, suites => \@SUITES ); - $content{make_search_url} = sub { return &Packages::CGI::make_search_url(@_) }; - $content{make_url} = sub { return &Packages::CGI::make_url(@_) }; - # needed to work around the limitations of the the FILTER syntax - $content{html_encode} = sub { return HTML::Entities::encode_entities(@_,'<>&"') }; - $content{uri_escape} = sub { return URI::Escape::uri_escape(@_) }; - $content{quotemeta} = sub { return quotemeta($_[0]) }; - foreach my $ssec ((keys %{$subsections->{$s}}, 'virtual')) { next if $ssec eq '-'; if ($sections_descs{$ssec}) {