Merge pull request #77 from scarabeusiv/master

Fix pluralized forms and whitespace in translations and fix the l10n tools
This commit is contained in:
Andrew Dolgov 2013-03-24 09:00:55 -07:00
commit 8850646ff3
44 changed files with 18998 additions and 17163 deletions

View File

@ -55,7 +55,7 @@ class Pref_Feeds extends Handler_Protected {
$cat['items'] = $this->get_category_items($line['id']);
$cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
$cat['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
if (count($cat['items']) > 0 || $show_empty_cats)
array_push($items, $cat);
@ -172,7 +172,7 @@ class Pref_Feeds extends Handler_Protected {
$cat['items'] = $this->get_category_items($line['id']);
$cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
$cat['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
if (count($cat['items']) > 0 || $show_empty_cats)
array_push($root['items'], $cat);
@ -214,13 +214,13 @@ class Pref_Feeds extends Handler_Protected {
array_push($cat['items'], $feed);
}
$cat['param'] = T_sprintf('(%d feeds)', count($cat['items']));
$cat['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
if (count($cat['items']) > 0 || $show_empty_cats)
array_push($root['items'], $cat);
$root['param'] += count($cat['items']);
$root['param'] = T_sprintf('(%d feeds)', $root['param']);
$root['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
} else {
$feed_result = db_query($this->link, "SELECT id, title, last_error,
@ -245,7 +245,7 @@ class Pref_Feeds extends Handler_Protected {
array_push($root['items'], $feed);
}
$root['param'] = T_sprintf('(%d feeds)', count($root['items']));
$root['param'] = vsprintf(ngettext('(%d feed)', '(%d feeds)', count($cat['items'])), count($cat['items']));
}
$fl = array();

View File

@ -288,11 +288,9 @@ class Pref_Users extends Handler_Protected {
WHERE id = '$uid'");
if ($show_password) {
print T_sprintf("Changed password of user <b>%s</b>
to <b>%s</b>", $login, $tmp_user_pwd);
print T_sprintf("Changed password of user <b>%s</b> to <b>%s</b>", $login, $tmp_user_pwd);
} else {
print T_sprintf("Sending new password of user <b>%s</b>
to <b>%s</b>", $login, $email);
print T_sprintf("Sending new password of user <b>%s</b> to <b>%s</b>", $login, $email);
}
require_once 'classes/ttrssmailer.php';

View File

@ -155,8 +155,8 @@ function confirmOP() {
}
}
print "<p>".T_sprintf("Finished. Performed <b>%d</b> update(s) up to schema
version <b>%d</b>.", $num_updates, $version)."</p>";
print "<p>".vsprintf(ngettext("Finished. Performed <b>%d</b> update up to schema version <b>%d</b>.",
"Finished. Performed <b>%d</b> updates up to schema version <b>%d</b>.", $num_updates), $num_updates, $version)."</p>";
print "<form method=\"GET\" action=\"backend.php\">
<input type=\"hidden\" name=\"op\" value=\"logout\">

View File

@ -12,7 +12,7 @@
$ERRORS[2] = __("This program requires cookies " .
"to function properly. Your browser doesn't seem to support them.");
$ERRORS[3] = __("Backend sanity check failed");
$ERRORS[3] = __("Backend sanity check failed.");
$ERRORS[4] = __("Frontend sanity check failed.");
@ -28,8 +28,7 @@
$ERRORS[9] = __("Configuration check failed");
$ERRORS[10] = __("Your version of MySQL is not currently supported. Please see
official site for more information.");
$ERRORS[10] = __("Your version of MySQL is not currently supported. Please see official site for more information.");
$ERRORS[11] = "[This error is not returned by server]";

View File

@ -80,7 +80,7 @@
$class = ($feedctr % 2) ? "even" : "odd";
if ($line['articles_archived'] > 0) {
$archived = sprintf(__("%d archived articles"), $line['articles_archived']);
$archived = sprintf(ngettext("%d archived article", "%d archived articles", $line['articles_archived']), $line['articles_archived']);
$archived = "&nbsp;<span class='subscribers'>($archived)</span>";
} else {
$archived = '';

View File

@ -1,4 +1,4 @@
<?php # This file has been generated at: Thu Mar 21 23:29:09 MSK 2013
<?php # This file has been generated at: Sun Mar 24 13:57:39 CET 2013
__("Title");
__("Title or Content");

View File

@ -979,9 +979,9 @@ function deleteSelection() {
var str;
if (getActiveFeedId() != 0) {
str = __("Delete %d selected articles in %s?");
str = ngettext("Delete %d selected article in %s?", "Delete %d selected articles in %s?" , rows.length);
} else {
str = __("Delete %d selected articles?");
str = ngettext("Delete %d selected article?", "Delete %d selected articles?", rows.length);
}
str = str.replace("%d", rows.length);
@ -1023,10 +1023,10 @@ function archiveSelection() {
var op;
if (getActiveFeedId() != 0) {
str = __("Archive %d selected articles in %s?");
str = ngettext("Archive %d selected article in %s?", "Archive %d selected articles in %s?", rows.length);
op = "archive";
} else {
str = __("Move %d archived articles back?");
str = ngettext("Move %d archived article back?", "Move %d archived articles back?", rows.length);
op = "unarchive";
}
@ -1070,7 +1070,7 @@ function catchupSelection() {
var fn = getFeedName(getActiveFeedId(), activeFeedIsCat());
var str = __("Mark %d selected articles in %s as read?");
var str = ngettext("Mark %d selected article in %s as read?", "Mark %d selected articles in %s as read?", rows.length);
str = str.replace("%d", rows.length);
str = str.replace("%s", fn);
@ -1317,7 +1317,7 @@ function catchupRelativeToArticle(below, id) {
if (ids_to_mark.length == 0) {
alert(__("No articles found to mark"));
} else {
var msg = __("Mark %d article(s) as read?").replace("%d", ids_to_mark.length);
var msg = ngettext("Mark %d article as read?", "Mark %d articles as read?", ids_to_mark.length).replace("%d", ids_to_mark.length);
if (getInitParam("confirm_feed_catchup") != 1 || confirm(msg)) {

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -68,7 +68,7 @@ function catchup_visible_articles(callback) {
var ids = get_visible_article_ids();
if (confirm(__("Mark %d displayed articles as read?").replace("%d", ids.length))) {
if (confirm(ngettext("Mark %d displayed article as read?", "Mark %d displayed articles as read?", ids.length).replace("%d", ids.length))) {
var query = "?op=rpc&method=catchupSelected" +
"&cmode=0&ids=" + param_escape(ids);
@ -515,7 +515,7 @@ function redraw_feedlist(feeds) {
$('feeds-content').innerHTML += "<li id='F-MORE-PROMPT'>" +
"<img src='images/blank_icon.gif'>" +
"<a href=\"#\" onclick=\"expand_feeds()\">" +
__("%d more...").replace("%d", feeds.length-10) +
ngettext("%d more...", "%d more...", feeds.length-10).replace("%d", feeds.length-10) +
"</a>" + "</li>";
}

View File

@ -40,9 +40,7 @@
<div id="overlay_inner">
<noscript>
<p>
<?php print_error(__("Your browser doesn't support Javascript, which is required
for this application to function properly. Please check your
browser settings.")) ?></p>
<?php print_error(__("Your browser doesn't support Javascript, which is required for this application to function properly. Please check your browser settings.")) ?></p>
</noscript>
<img src="images/indicator_white.gif"/>

View File

@ -37,7 +37,7 @@ function exportData() {
} else {
$("export_status_message").innerHTML =
__("Finished, exported %d articles. You can download the data <a class='visibleLink' href='%u'>here</a>.")
ngettext("Finished, exported %d article. You can download the data <a class='visibleLink' href='%u'>here</a>.", "Finished, exported %d articles. You can download the data <a class='visibleLink' href='%u'>here</a>.", exported)
.replace("%d", exported)
.replace("%u", "backend.php?op=pluginhandler&plugin=import_export&subop=exportget");

View File

@ -382,8 +382,10 @@ class Import_Export extends Plugin implements IHandler {
}
print "<p>" .
T_sprintf("Finished: %d articles processed, %d imported, %d feeds created.",
$num_processed, $num_imported, $num_feeds_created) .
vsprintf(__("Finished: ")).
vsprintf(ngettext("%d article processed, ", "%d articles processed, ", $num_processed), $num_processed).
vsprintf(ngettext("%d imported, ", "%d imported, ", $num_imported), $num_imported).
vsprintf(ngettext("%d feed created.", "%d feeds created.", $num_feeds_created), $num_feeds_created).
"</p>";
} else {
@ -421,8 +423,7 @@ class Import_Export extends Plugin implements IHandler {
$this->perform_data_import($this->link, $_FILES['export_file']['tmp_name'], $_SESSION['uid']);
} else {
print "<p>" . T_sprintf("Could not upload file. You might need to adjust upload_max_filesize
in PHP.ini (current value = %s)", ini_get("upload_max_filesize")) . " or use CLI import tool.</p>";
print "<p>" . T_sprintf("Could not upload file. You might need to adjust upload_max_filesize in PHP.ini (current value = %s)", ini_get("upload_max_filesize")) . " or use CLI import tool.</p>";
}

View File

@ -1,5 +1,9 @@
#!/bin/sh
LC_ALL=C
LANG=C
LANGUAGE=C
BASENAME=`basename $0`
TMPFILE="/tmp/$BASENAME-$$.tmp"
OUTFILE="include/localized_schema.php"

View File

@ -3,18 +3,14 @@ TEMPLATE=messages.pot
./utils/update-schema-translations.sh
xgettext -kT_js_decl -kT_sprintf -kT_ngettext:1,2 -k__ -L PHP -o $TEMPLATE *.php mobile/*.php include/*.php `find classes -iname '*.php'` `find plugins -iname '*.php'`
xgettext -kT_js_decl -kT_sprintf -kT_ngettext:1,2 -k__ -L PHP -o $TEMPLATE *.php include/*.php `find classes -iname '*.php'` `find plugins -iname '*.php'`
xgettext --from-code utf-8 -k__ -L Java -j -o $TEMPLATE js/*.js `find plugins -iname '*.js'`
update_lang() {
if [ -f $1.po ]; then
TMPFILE=/tmp/update-translations.$$
msgmerge -o $TMPFILE $1.po $TEMPLATE
mv $TMPFILE $1.po
msgfmt --statistics $1.po
msgfmt -o $1.mo $1.po
msgmerge --no-wrap --width 1 -U $1.po $TEMPLATE
msgfmt --statistics $1.po -o $1.mo
else
echo "Usage: $0 [-p|<basename>]"
fi