From 721adff0d70d1f13dee093b7a0620a2a9c088d02 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 17 Jul 2005 13:16:50 +0000 Subject: [PATCH] Start gettextifying Perl scripts (and thus titles) as well. --- html/add-tournament.pl | 2 +- html/ccbs.pm | 13 ++-- html/po/nb_NO.po | 18 ++++- html/po/templates.pot | 148 ++++++++++++++++++++++++++++++++++++++++- intl/make-all-pot.sh | 5 ++ 5 files changed, 179 insertions(+), 7 deletions(-) diff --git a/html/add-tournament.pl b/html/add-tournament.pl index 44c0536..471ce1f 100755 --- a/html/add-tournament.pl +++ b/html/add-tournament.pl @@ -13,7 +13,7 @@ my $machines = ccbs::db_fetch_all($dbh, 'SELECT * FROM machines'); my $scoringsystems = ccbs::db_fetch_all($dbh, 'SELECT * FROM scoringsystems'); ccbs::print_header(); -ccbs::process_template('add-tournament.tmpl', 'Legg til turnering', { +ccbs::process_template('add-tournament.tmpl', _('Add tournament'), { seasons => $seasons, countries => $countries, machines => $machines, diff --git a/html/ccbs.pm b/html/ccbs.pm index 4431da4..d3f0721 100755 --- a/html/ccbs.pm +++ b/html/ccbs.pm @@ -20,7 +20,12 @@ our $ccbs_dbdebug = 0; # Set this flag to disable any admin tasks -- it's quite crude, but hey :-) our $ccbs_noadmin = 0; - + +# Hack to get the non-templatized gettext stuff working +*_ = sub { + return Locale::gettext::gettext(@_); +}; + sub print_header { print CGI::header(-type=>'text/html; charset=utf-8'); } @@ -101,13 +106,13 @@ sub user_error { my $msg = shift; ccbs::print_header(); - ccbs::process_template('user-error.tmpl', 'Feil', + ccbs::process_template('user-error.tmpl', _('Error'), { message => $msg }); exit; } sub admin_only { - user_error("Beklager, databasen står i no-admin-mode.") if ($ccbs_noadmin); + user_error(_("Sorry, the database is in no-admin-mode.")) if ($ccbs_noadmin); } $SIG{__DIE__} = sub { @@ -116,7 +121,7 @@ $SIG{__DIE__} = sub { return if $msg =~ m#Win32/Registry.pm#; ccbs::print_header(); - ccbs::process_template('error.tmpl', 'Internal Server Error', + ccbs::process_template('error.tmpl', _('Internal Server Error'), { message => HTML::Entities::encode_entities($msg) }); }; diff --git a/html/po/nb_NO.po b/html/po/nb_NO.po index ce249bb..d2c54b7 100644 --- a/html/po/nb_NO.po +++ b/html/po/nb_NO.po @@ -34,7 +34,7 @@ msgid "" msgstr "" "Project-Id-Version: ccbs--mainline- 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-55-17 14:55+0200\n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" "PO-Revision-Date: 2005-07-17 01:55+0200\n" "Last-Translator: Steinar H. Gunderson \n" "Language-Team: Norwegian \n" @@ -136,6 +136,22 @@ msgstr "Turneringer" msgid "Song selector" msgstr "Sangvelger" +#: ccbs.pm:109 +msgid "Error" +msgstr "Feil" + +#: ccbs.pm:115 +msgid "Sorry, the database is in no-admin-mode." +msgstr "Beklager, databasen står i no-admin-modus." + +#: ccbs.pm:124 +msgid "Internal Server Error" +msgstr "Intern feil" + +#: add-tournament.pl:16 +msgid "Add tournament" +msgstr "Legg til turnering" + msgid "Nick" msgstr "Nick" diff --git a/html/po/templates.pot b/html/po/templates.pot index d5d1116..b29133a 100644 --- a/html/po/templates.pot +++ b/html/po/templates.pot @@ -8,6 +8,12 @@ # ccbs template file for templates/index.tmpl # #-#-#-#-# main.tmpl.pot (ccbs) #-#-#-#-# # ccbs template file for templates/main.tmpl +# #-#-#-#-# messages.pot (PACKAGE VERSION) #-#-#-#-# +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# # #-#-#-#-# players.tmpl.pot (ccbs) #-#-#-#-# # ccbs template file for templates/players.tmpl # #-#-#-#-# player.tmpl.pot (ccbs) #-#-#-#-# @@ -32,11 +38,135 @@ # ccbs template file for templates/tournaments.tmpl # #-#-#-#-# user-error.tmpl.pot (ccbs) #-#-#-#-# # ccbs template file for templates/user-error.tmpl +#, fuzzy msgid "" msgstr "" +"#-#-#-#-# add-tournament.tmpl.pot (ccbs) #-#-#-#-#\n" "Project-Id-Version: ccbs\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-55-17 14:55+0200\n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# do-add-tournament.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# error.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# index.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# main.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# messages.pot (PACKAGE VERSION) #-#-#-#-#\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-07-17 15:15+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# players.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# player.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# randomsongs.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# registration.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# set-active-tournament.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# shorttitles.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# show-tournament.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# songratings.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# songs.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# song.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# tournaments.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"#-#-#-#-# user-error.tmpl.pot (ccbs) #-#-#-#-#\n" +"Project-Id-Version: ccbs\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-15-17 15:15+0200\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -129,6 +259,22 @@ msgstr "" msgid "Song selector" msgstr "" +#: ccbs.pm:109 +msgid "Error" +msgstr "" + +#: ccbs.pm:115 +msgid "Sorry, the database is in no-admin-mode." +msgstr "" + +#: ccbs.pm:124 +msgid "Internal Server Error" +msgstr "" + +#: add-tournament.pl:16 +msgid "Add tournament" +msgstr "" + msgid "Nick" msgstr "" diff --git a/intl/make-all-pot.sh b/intl/make-all-pot.sh index 1d513bf..51e4eb3 100755 --- a/intl/make-all-pot.sh +++ b/intl/make-all-pot.sh @@ -3,6 +3,11 @@ set -e rm -f templates/*.pot + +# Extract strings from all the Perl code +xgettext --keyword=_ --from-code=utf-8 -o templates/messages.pot -L Perl *.{pm,pl} + +# ...and from all the TT templates for FILE in templates/*.tmpl; do echo $FILE... perl -I../intl ../intl/make-pot.pl $FILE | msguniq > $FILE.pot -- 2.39.2