diff --git a/Makefile b/Makefile index 011f3a9e..13a90b91 100755 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ built-docs: docs/api/phpdoc.ini htdocs/*.php inc/*.php phpdoc -c docs/api/phpdoc.ini || echo "NOTICE: Failed to build optional API docs" touch built-docs -built-po: htdocs/always.php scripts/po/rebuild-translations.sh scripts/po/extract.pl po/*.po +built-po: htdocs/always.php scripts/po/rebuild-translations.sh po/*.po scripts/po/rebuild-translations.sh touch built-po diff --git a/htdocs/help.php b/htdocs/help.php index 12605edd..298cb6b1 100644 --- a/htdocs/help.php +++ b/htdocs/help.php @@ -15,14 +15,14 @@ if ( isset($_SERVER['HTTP_REFERER']) ) { $wiki_help = 'w/Help/'.$wiki_help; } -$content = translate('

Help

+$content = sprintf(translate('

Help

For initial help you should visit the DAViCal Home Page or take -a look at the DAViCal Wiki.

+a look at the DAViCal Wiki.

If you can\'t find the answers there, visit us on IRC in the #davical channel on irc.oftc.net, or send a question to the DAViCal Users mailing list.

The mailing list -archives can be helpful too.

'); +archives can be helpful too.

'), $wiki_help); echo $content; diff --git a/inc/other_translated_strings.php b/inc/other_translated_strings.php index 105aa71a..1f831200 100644 --- a/inc/other_translated_strings.php +++ b/inc/other_translated_strings.php @@ -3,32 +3,29 @@ * This file is not included anywhere. It exists as a way of ensuring some * strings, which may come from the database, or from other places, are * present in the translation files. -* -* It is also used to add extra entries to the translations which document -* the sense of a word or phrase to assist with translations. */ // Groups, from the database -i18n("Admin "); +# Translators: in the sense of 'systems admin' i18n("Admin"); -i18n("Group "); +# Translators: in the sense of a group of people i18n("Group"); -i18n("Public "); +# Translators: in the sense of being available to all users i18n("Public"); -i18n("Resource "); +# Translators a thing which might be booked: a room, a carpark, a projector... i18n("Resource"); -i18n("No. "); +# Translators: short for 'Number' i18n("No."); -i18n("No "); +# Translators: not 'Yes' i18n("No"); i18n("Yes"); -i18n("Id "); +# Translators: short for 'Identifier' i18n("Id"); i18n('View this user record'); @@ -36,7 +33,8 @@ i18n('Edit this user record'); i18n('You are viewing'); i18n('You are editing'); -i18n("forget me not "); +# Translators: this is a colloquial phrase in english (the name of a flower) and is an option allowing people to log in automatically in future +i18n("forget me not"); // Date format types i18n('European'); diff --git a/po/pofilelist.txt b/po/pofilelist.txt new file mode 100644 index 00000000..6860b55a --- /dev/null +++ b/po/pofilelist.txt @@ -0,0 +1,52 @@ +htdocs/always.php +htdocs/caldav.php +htdocs/feed.php +htdocs/freebusy.php +htdocs/help.php +htdocs/public.php +htdocs/setup.php +htdocs/tools.php +htdocs/upgrade.php +htdocs/well-known.php +inc/auth-functions.php +inc/caldav-BIND.php +inc/caldav-DELETE.php +inc/caldav-GET.php +inc/caldav-MKCOL.php +inc/caldav-MOVE.php +inc/caldav-OPTIONS.php +inc/caldav-PROPFIND.php +inc/caldav-PROPPATCH.php +inc/caldav-PUT-default.php +inc/caldav-PUT-functions.php +inc/caldav-PUT.php +inc/caldav-PUT-vcard.php +inc/caldav-REPORT-calquery.php +inc/caldav-REPORT-cardquery.php +inc/caldav-REPORT.php +inc/caldav-REPORT-sync-collection.php +inc/CalDAVRequest.php +inc/DAViCalSession.php +inc/DAVResource.php +inc/drivers_imap_pam.php +inc/drivers_ldap.php +inc/drivers_pwauth_pam.php +inc/drivers_squid_pam.php +inc/interactive-page.php +inc/iSchedule.php +inc/other_translated_strings.php +inc/page-header.php +inc/Principal.php +inc/ui/collection-edit.php +inc/ui/principal-browse.php +inc/ui/principal-edit.php +inc/WritableCollection.php + +../awl/inc/classBrowser.php +../awl/inc/classEditor.php +../awl/inc/DataEntry.php +../awl/inc/iCalendar.php +../awl/inc/PgQuery.php +../awl/inc/Session.php +../awl/inc/User.php + diff --git a/scripts/po/extract.pl b/scripts/po/extract.pl deleted file mode 100755 index 4016403f..00000000 --- a/scripts/po/extract.pl +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/perl -# -# Perl script to extract strings from all the files and print -# to stdout for use with xgettext. -# -# This script is based on the one provided with the Horde project -# http://www.horde.org/. As such, it inherits the license from the -# original version. You can find that license here: -# -# http://cvs.horde.org/co.php/horde/COPYING?r=2.1 -# -# I'm not exactly sure what the license restrictions are in this case, -# but I want to give full credit to the original authors, including -# the Gallery project which the script passed through on the way. -# -# Copyright 2000-2002 Joris Braakman -# Copyright 2001-2002 Chuck Hagenbuch -# Copyright 2001-2002 Jan Schneider -# Copyright 2002-2003 Bharat Mediratta -# -# -use FileHandle; -use File::Basename; -use File::Find; -use IPC::Open2; -use strict; - -my %strings; - -my $exts = '(php|pl)'; - -foreach my $moduleDir (@ARGV) { - find(\&extract, $moduleDir); -} - -print join("\n" => sort keys %strings), "\n"; - -sub extract { - my $file = $File::Find::name; - my $dir = $File::Find::dir; - my $fd = new FileHandle; - - if ($file =~ /\.$exts$/) { - open($fd, basename($file)); - my $data = join('' => <$fd>); - - # grab phrases for translate( or i18n( calls; capture string parameter enclosed - # in single or double quotes including concatenated strings like 'one' . "two" - while ($data =~ - /(translate|i18n)\(\s*(((\s*\.\s*)?('((\\')?[^']*)*[^\\]'|"((\\")?[^"]*)*[^\\]"))+)\s*\)/sg) { - # Call out to php to parse string.. - my ($in, $out); - open2($in, $out, 'php -q'); - print $out ''; - close $out; - my $text = join('', <$in>); - close $in; - next if ( $text eq "" ); - $text =~ s/\"/\\\"/sg; # escape double-quotes - $strings{qq{gettext("$text")}}++; - } - - # grab phrases of this format: translate(array('one' => '...', 'many' => '...')) - while ($data =~ /translate\(.*?array\('one'\s*=>\s*'(.*?)'.*?'many'\s*=>\s*'(.*?)'.*?\).*?\)/sg) { - my ($one, $many) = ($1, $2); - $one =~ s/\"/\\\"/sg; # escape double-quotes - $many =~ s/\"/\\\"/sg; # escape double-quotes - $strings{qq{ngettext("$one", "$many")}}++; - } - - # grab phrases of this format: translate(array('text' => '...', ...)) - while ($data =~ /translate\(\s*array\('text'\s*=>\s+'(.*?[^\\])'/sg) { - my $text = $1; - next if ( $text eq "" ); - $text =~ s/\"/\\\"/sg; # escape double-quotes - $strings{qq{gettext("$text")}}++; - } - - # grab phrases of this format {g->text ..... } - while ($data =~ /(\{\s*g->text\s+.*?[^\\]\})/sg) { - my $string = $1; - my $text; - my $one; - my $many; - - # Ignore translations of the form: - # text=$foo - # as we expect those to be variables containing values that - # have been marked elsewhere with the i18n() function - if ($string =~ /text=\$/) { - next; - } - - # text=..... - if ($string =~ /text="(.*?[^\\])"/s) { - $text = $1; - } - elsif ($string =~ /text='(.*?)'/s) { - $text = $1; - $text =~ s/\"/\\\"/sg; # escape double-quotes - } - - # one = ..... - if ($string =~ /\s+one="(.*?[^\\])"/s) { - $one = $1; - } - elsif ($string =~ /\s+one='(.*?)'/s) { - $one = $1; - $one =~ s/\"/\\\"/sg; # escape double-quotes - } - - # many = ..... - if ($string =~ /\s+many="(.*?[^\\])"/s) { - $many = $1; - } - elsif ($string =~ /\s+many='(.*?)'/s) { - $many = $1; - $many =~ s/\"/\\\"/sg; # escape double-quotes - } - - # pick gettext() or ngettext() - if ($text) { - $string = qq{gettext("$text")}; - } - elsif ($one and $many) { - $string = qq{ngettext("$one", "$many")}; - } - else { - # parse error - $text =~ s/\n/\n>/sg; - print STDERR "extract.pl parse error: $file:\n"; - print STDERR "> $string\n"; - exit; - } - - $string =~ s/\\\}/\}/sg; # unescape right-curly-braces - $strings{qq{$string}}++; - } - - close($fd); - } -} diff --git a/scripts/po/rebuild-translations.sh b/scripts/po/rebuild-translations.sh index ebcd7bfe..a8c11390 100755 --- a/scripts/po/rebuild-translations.sh +++ b/scripts/po/rebuild-translations.sh @@ -7,7 +7,6 @@ [ -n "${DEBUG}" ] && set -o xtrace -POTOOLS="scripts/po" PODIR="po" LOCALEDIR="locale" APPLICATION="davical" @@ -21,10 +20,10 @@ if [ ! -d "${AWL_LOCATION}" ]; then fi fi -${POTOOLS}/extract.pl htdocs inc ${AWL_LOCATION}/inc > ${PODIR}/strings.raw -xgettext --keyword=_ -C --no-location --output=${PODIR}/messages.tmp ${PODIR}/strings.raw -sed -e 's/CHARSET/UTF-8/' <${PODIR}/messages.tmp >${PODIR}/messages.pot -rm ${PODIR}/messages.tmp +sed "s:../awl:${AWL_LOCATION}:" ${PODIR}/pofilelist.txt > ${PODIR}/pofilelist.tmp +xgettext --no-location --add-comments=Translators --keyword=translate --keyword=i18n --output=${PODIR}/messages.tmp -s -f ${PODIR}/pofilelist.tmp +sed 's.^"Content-Type: text/plain; charset=CHARSET\\n"."Content-Type: text/plain; charset=UTF-8\\n".' ${PODIR}/messages.tmp > ${PODIR}/messages.pot +rm ${PODIR}/messages.tmp ${PODIR}/pofilelist.tmp for LOCALE in `grep VALUES dba/supported_locales.sql | cut -f2 -d"'" | cut -f1 -d'_'` ; do @@ -32,7 +31,7 @@ for LOCALE in `grep VALUES dba/supported_locales.sql | cut -f2 -d"'" | cut -f1 - if [ ! -f ${PODIR}/${LOCALE}.po ] ; then cp ${PODIR}/messages.pot ${PODIR}/${LOCALE}.po fi - msgmerge --quiet --width 105 --update ${PODIR}/${LOCALE}.po ${PODIR}/messages.pot + msgmerge --no-fuzzy-matching --quiet --width 105 --update ${PODIR}/${LOCALE}.po ${PODIR}/messages.pot done for LOCALE in `grep VALUES dba/supported_locales.sql | cut -f2 -d"'" | cut -f1 -d'_'` ; do