more i18n work

This commit is contained in:
Andrew Dolgov 2007-03-05 13:50:46 +01:00
parent 8497d2b976
commit 4dccf1ed93
9 changed files with 117 additions and 95 deletions

View file

@ -3188,6 +3188,14 @@
<img src=\"images/sign_info.png\">$msg</div>"; <img src=\"images/sign_info.png\">$msg</div>";
} }
function print_notice($msg) {
return print format_notice($msg);
}
function print_warning($msg) {
return print format_warning($msg);
}
function startup_gettext() { function startup_gettext() {
# Get locale from Accept-Language header # Get locale from Accept-Language header
@ -3201,4 +3209,9 @@
} }
} }
function T_sprintf() {
$args = func_get_args();
return vsprintf(__(array_shift($args)), $args);
}
?> ?>

Binary file not shown.

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 1.0\n" "Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-03-05 17:02+0300\n" "POT-Creation-Date: 2007-03-05 18:46+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -114,10 +114,18 @@ msgstr ""
msgid "This program requires XmlHttpRequest " msgid "This program requires XmlHttpRequest "
msgstr "" msgstr ""
#: errors.php:6
msgid "to function properly. Your browser doesn't seem to support it."
msgstr ""
#: errors.php:8 #: errors.php:8
msgid "This program requires cookies " msgid "This program requires cookies "
msgstr "" msgstr ""
#: errors.php:9
msgid "to function properly. Your browser doesn't seem to support them."
msgstr ""
#: errors.php:11 #: errors.php:11
msgid "Backend sanity check failed" msgid "Backend sanity check failed"
msgstr "" msgstr ""
@ -276,7 +284,7 @@ msgstr ""
msgid "Page" msgid "Page"
msgstr "" msgstr ""
#: functions.php:2798 modules/pref-filters.php:257 #: functions.php:2798 modules/pref-filters.php:259
msgid "Feed" msgid "Feed"
msgstr "" msgstr ""
@ -296,16 +304,24 @@ msgstr ""
msgid "Tags" msgid "Tags"
msgstr "" msgstr ""
#: login_form.php:49 modules/pref-feeds.php:264 modules/pref-users.php:29
msgid "Login:"
msgstr "Пользователь:"
#: login_form.php:51 modules/pref-feeds.php:270
msgid "Password:"
msgstr "Пароль"
#: opml.php:103 opml.php:107 #: opml.php:103 opml.php:107
msgid "OPML Utility" msgid "OPML Utility"
msgstr "" msgstr ""
#: opml.php:110 #: opml.php:110
msgid "<p>Importing OPML (using DOMXML extension)...</p>" msgid "Importing OPML (using DOMXML extension)..."
msgstr "" msgstr ""
#: opml.php:114 #: opml.php:114
msgid "<p>Importing OPML (using DOMDocument extension)...</p>" msgid "Importing OPML (using DOMDocument extension)..."
msgstr "" msgstr ""
#: opml.php:120 #: opml.php:120
@ -407,6 +423,10 @@ msgstr ""
msgid "config: SESSION_EXPIRE_TIME should be greater or equal to" msgid "config: SESSION_EXPIRE_TIME should be greater or equal to"
msgstr "" msgstr ""
#: sanity_check.php:53
msgid "SESSION_COOKIE_LIFETIME"
msgstr ""
#: sanity_check.php:61 #: sanity_check.php:61
msgid "config: DATABASE_BACKED_SESSIONS is incompatible with SINGLE_USER_MODE" msgid "config: DATABASE_BACKED_SESSIONS is incompatible with SINGLE_USER_MODE"
msgstr "" msgstr ""
@ -424,7 +444,7 @@ msgid "Actions..."
msgstr "Действия..." msgstr "Действия..."
#: tt-rss.php:129 modules/popup-dialog.php:80 modules/popup-dialog.php:149 #: tt-rss.php:129 modules/popup-dialog.php:80 modules/popup-dialog.php:149
#: modules/pref-feeds.php:750 #: modules/pref-feeds.php:751
msgid "Search" msgid "Search"
msgstr "Поиск" msgstr "Поиск"
@ -505,7 +525,7 @@ msgstr "Превед,"
msgid "Help topic not found." msgid "Help topic not found."
msgstr "Раздел помощи не найден." msgstr "Раздел помощи не найден."
#: modules/help.php:30 modules/popup-dialog.php:35 modules/pref-feeds.php:699 #: modules/help.php:30 modules/popup-dialog.php:35 modules/pref-feeds.php:700
msgid "Close this window" msgid "Close this window"
msgstr "Закрыть окно" msgstr "Закрыть окно"
@ -572,7 +592,7 @@ msgstr ""
#: modules/popup-dialog.php:75 modules/popup-dialog.php:152 #: modules/popup-dialog.php:75 modules/popup-dialog.php:152
#: modules/popup-dialog.php:202 modules/popup-dialog.php:287 #: modules/popup-dialog.php:202 modules/popup-dialog.php:287
#: modules/popup-dialog.php:377 modules/pref-feeds.php:120 #: modules/popup-dialog.php:377 modules/pref-feeds.php:120
#: modules/pref-feeds.php:331 modules/pref-feeds.php:707 #: modules/pref-feeds.php:331 modules/pref-feeds.php:708
#: modules/pref-filters.php:118 modules/pref-users.php:58 #: modules/pref-filters.php:118 modules/pref-users.php:58
msgid "Cancel" msgid "Cancel"
msgstr "Отмена" msgstr "Отмена"
@ -581,7 +601,7 @@ msgstr "Отмена"
msgid "Where:" msgid "Where:"
msgstr "Где:" msgstr "Где:"
#: modules/popup-dialog.php:104 modules/pref-filters.php:284 #: modules/popup-dialog.php:104 modules/pref-filters.php:286
msgid "All feeds" msgid "All feeds"
msgstr "" msgstr ""
@ -629,7 +649,7 @@ msgstr ""
msgid "Create" msgid "Create"
msgstr "" msgstr ""
#: modules/popup-dialog.php:209 modules/pref-filters.php:223 #: modules/popup-dialog.php:209 modules/pref-filters.php:225
msgid "Create filter" msgid "Create filter"
msgstr "" msgstr ""
@ -688,7 +708,7 @@ msgid "Add existing tag:"
msgstr "" msgstr ""
#: modules/popup-dialog.php:373 modules/pref-feeds.php:329 #: modules/popup-dialog.php:373 modules/pref-feeds.php:329
#: modules/pref-feeds.php:705 modules/pref-filters.php:114 #: modules/pref-feeds.php:706 modules/pref-filters.php:114
#: modules/pref-users.php:55 #: modules/pref-users.php:55
msgid "Save" msgid "Save"
msgstr "Сохранить" msgstr "Сохранить"
@ -741,14 +761,6 @@ msgstr "Нет связей"
msgid "Article purging:" msgid "Article purging:"
msgstr "Удаление сообщений:" msgstr "Удаление сообщений:"
#: modules/pref-feeds.php:264 modules/pref-users.php:29
msgid "Login:"
msgstr "Пользователь:"
#: modules/pref-feeds.php:270
msgid "Password:"
msgstr "Пароль"
#: modules/pref-feeds.php:285 #: modules/pref-feeds.php:285
msgid "Hide from \"Other Feeds\"" msgid "Hide from \"Other Feeds\""
msgstr "" msgstr ""
@ -780,59 +792,59 @@ msgstr ""
msgid "Category <b>$%s</b> already exists in the database." msgid "Category <b>$%s</b> already exists in the database."
msgstr "" msgstr ""
#: modules/pref-feeds.php:577 #: modules/pref-feeds.php:578
msgid "Unable to delete non empty feed categories." msgid "Unable to delete non empty feed categories."
msgstr "" msgstr ""
#: modules/pref-feeds.php:594 #: modules/pref-feeds.php:595
msgid "Create category" msgid "Create category"
msgstr "Создать категорию" msgstr "Создать категорию"
#: modules/pref-feeds.php:694 #: modules/pref-feeds.php:695
msgid "No feed categories defined." msgid "No feed categories defined."
msgstr "Категории отсутствуют." msgstr "Категории отсутствуют."
#: modules/pref-feeds.php:712 modules/pref-feeds.php:957 #: modules/pref-feeds.php:713 modules/pref-feeds.php:958
#: modules/pref-filters.php:334 modules/pref-labels.php:278 #: modules/pref-filters.php:336 modules/pref-labels.php:278
#: modules/pref-users.php:318 #: modules/pref-users.php:315
msgid "Edit" msgid "Edit"
msgstr "Редактировать" msgstr "Редактировать"
#: modules/pref-feeds.php:714 modules/pref-filters.php:336 #: modules/pref-feeds.php:715 modules/pref-filters.php:338
#: modules/pref-labels.php:280 modules/pref-users.php:320 #: modules/pref-labels.php:280 modules/pref-users.php:317
msgid "Remove" msgid "Remove"
msgstr "Удалить" msgstr "Удалить"
#: modules/pref-feeds.php:735 #: modules/pref-feeds.php:736
msgid "Some feeds have update errors (click for details)" msgid "Some feeds have update errors (click for details)"
msgstr "" msgstr ""
#: modules/pref-feeds.php:764 #: modules/pref-feeds.php:765
msgid "Top 25" msgid "Top 25"
msgstr "" msgstr ""
#: modules/pref-feeds.php:960 #: modules/pref-feeds.php:961
msgid "Unsubscribe" msgid "Unsubscribe"
msgstr "" msgstr ""
#: modules/pref-feeds.php:970 #: modules/pref-feeds.php:971
msgid "Recategorize" msgid "Recategorize"
msgstr "" msgstr ""
#: modules/pref-feeds.php:978 #: modules/pref-feeds.php:979
#, fuzzy #, fuzzy
msgid "Edit categories" msgid "Edit categories"
msgstr "Создать категорию" msgstr "Создать категорию"
#: modules/pref-feeds.php:989 #: modules/pref-feeds.php:990
msgid "OPML" msgid "OPML"
msgstr "" msgstr ""
#: modules/pref-feeds.php:995 #: modules/pref-feeds.php:996
msgid "Import" msgid "Import"
msgstr "" msgstr ""
#: modules/pref-feeds.php:1002 #: modules/pref-feeds.php:1003
msgid "Export OPML" msgid "Export OPML"
msgstr "" msgstr ""
@ -845,29 +857,34 @@ msgstr "Редактор пользователей"
msgid "Enabled" msgid "Enabled"
msgstr "" msgstr ""
#: modules/pref-filters.php:256 #: modules/pref-filters.php:194
msgid "Filter expression" #, php-format
msgid "Created filter <b>%s</b>"
msgstr "" msgstr ""
#: modules/pref-filters.php:258 #: modules/pref-filters.php:258
msgid "Filter expression"
msgstr ""
#: modules/pref-filters.php:260
#, fuzzy #, fuzzy
msgid "Match" msgid "Match"
msgstr "Поиск:" msgstr "Поиск:"
#: modules/pref-filters.php:259 #: modules/pref-filters.php:261
#, fuzzy #, fuzzy
msgid "Action" msgid "Action"
msgstr "Действия..." msgstr "Действия..."
#: modules/pref-filters.php:293 #: modules/pref-filters.php:295
msgid "(Disabled)" msgid "(Disabled)"
msgstr "" msgstr ""
#: modules/pref-filters.php:311 #: modules/pref-filters.php:313
msgid "(Inverse)" msgid "(Inverse)"
msgstr "" msgstr ""
#: modules/pref-filters.php:326 modules/pref-filters.php:347 #: modules/pref-filters.php:328 modules/pref-filters.php:349
#, fuzzy #, fuzzy
msgid "No filters defined." msgid "No filters defined."
msgstr "Категории отсутствуют." msgstr "Категории отсутствуют."
@ -904,9 +921,7 @@ msgstr ""
#: modules/pref-users.php:123 #: modules/pref-users.php:123
#, php-format #, php-format
msgid "" msgid "Added user <b>%s</b> with password <b>%s</b>"
"Added user <b>%s</b>\n"
"\t\t\t\t\t\t with password <b>%s</b>"
msgstr "" msgstr ""
#: modules/pref-users.php:130 #: modules/pref-users.php:130
@ -914,28 +929,28 @@ msgstr ""
msgid "Could not create user <b>%s</b>" msgid "Could not create user <b>%s</b>"
msgstr "" msgstr ""
#: modules/pref-users.php:135 #: modules/pref-users.php:134
#, php-format #, php-format
msgid "User <b>%s</b> already exists." msgid "User <b>%s</b> already exists."
msgstr "" msgstr ""
#: modules/pref-users.php:157 #: modules/pref-users.php:154
#, php-format #, php-format
msgid "" msgid ""
"Changed password of user <b>%s</b>\n" "Changed password of user <b>%s</b>\n"
"\t\t\t\t\t to <b>%s</b>" "\t\t\t\t\t to <b>%s</b>"
msgstr "" msgstr ""
#: modules/pref-users.php:194 #: modules/pref-users.php:191
msgid "Create user" msgid "Create user"
msgstr "Добавить пользователя" msgstr "Добавить пользователя"
#: modules/pref-users.php:316 #: modules/pref-users.php:313
#, fuzzy #, fuzzy
msgid "User details" msgid "User details"
msgstr "Редактор пользователей" msgstr "Редактор пользователей"
#: modules/pref-users.php:322 #: modules/pref-users.php:319
#, fuzzy #, fuzzy
msgid "Reset password" msgid "Reset password"
msgstr "Пароль" msgstr "Пароль"

View file

@ -46,9 +46,9 @@ window.onload = init;
<?php $_SESSION['login_error_msg'] = ""; ?> <?php $_SESSION['login_error_msg'] = ""; ?>
<?php } ?> <?php } ?>
<table> <table>
<tr><td align="right">Login:</td> <tr><td align="right"><?php echo __("Login:") ?></td>
<td align="right"><input name="login"></td></tr> <td align="right"><input name="login"></td></tr>
<tr><td align="right">Password:</td> <tr><td align="right"><?php echo __("Password:") ?></td>
<td align="right"><input type="password" name="password"></td></tr> <td align="right"><input type="password" name="password"></td></tr>
<!-- <tr><td colspan="2"> <!-- <tr><td colspan="2">
<input type="checkbox" name="remember_me" id="remember_me"> <input type="checkbox" name="remember_me" id="remember_me">

View file

@ -443,9 +443,9 @@
} }
if (subscribe_to_feed($link, $feed_url, $cat_id)) { if (subscribe_to_feed($link, $feed_url, $cat_id)) {
print format_notice(sprintf(__("Subscribed to <b>%s</b>."), $feed_url)); print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url));
} else { } else {
print format_warning(sprintf(__("Already subscribed to <b>%s</b>."), $feed_url)); print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url));
} }
if ($p_from != 'tt-rss') { if ($p_from != 'tt-rss') {
@ -547,7 +547,8 @@
} else { } else {
print format_warning(sprintf(__("Category <b>$%s</b> already exists in the database."), $feed_cat)); print_warning(T_sprintf("Category <b>$%s</b> already exists in the database.",
$feed_cat));
} }
} }

View file

@ -148,49 +148,45 @@
enabled = $enabled, enabled = $enabled,
inverse = $inverse, inverse = $inverse,
action_param = '$action_param' action_param = '$action_param'
WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]); WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]);
} }
if ($subop == "remove") { if ($subop == "remove") {
if (!WEB_DEMO_MODE) { $ids = split(",", db_escape_string($_GET["ids"]));
$ids = split(",", db_escape_string($_GET["ids"])); foreach ($ids as $id) {
db_query($link, "DELETE FROM ttrss_filters WHERE id = '$id' AND owner_uid = ". $_SESSION["uid"]);
foreach ($ids as $id) {
db_query($link, "DELETE FROM ttrss_filters WHERE id = '$id' AND owner_uid = ". $_SESSION["uid"]);
}
} }
} }
if ($subop == "add") { if ($subop == "add") {
if (!WEB_DEMO_MODE) { $regexp = db_escape_string(trim($_GET["reg_exp"]));
$filter_type = db_escape_string(trim($_GET["filter_type"]));
$feed_id = db_escape_string($_GET["feed_id"]);
$action_id = db_escape_string($_GET["action_id"]);
$action_param = db_escape_string($_GET["action_param"]);
$regexp = db_escape_string(trim($_GET["reg_exp"])); $inverse = checkbox_to_sql_bool(db_escape_string($_GET["inverse"]));
$filter_type = db_escape_string(trim($_GET["filter_type"]));
$feed_id = db_escape_string($_GET["feed_id"]);
$action_id = db_escape_string($_GET["action_id"]);
$action_param = db_escape_string($_GET["action_param"]);
$inverse = checkbox_to_sql_bool(db_escape_string($_GET["inverse"])); if (!$regexp) return;
if (!$regexp) return; if (!$feed_id) {
$feed_id = 'NULL';
} else {
$feed_id = sprintf("'%s'", db_escape_string($feed_id));
}
if (!$feed_id) { $result = db_query($link,
$feed_id = 'NULL'; "INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id,
} else { action_id, action_param, inverse)
$feed_id = sprintf("'%s'", db_escape_string($feed_id)); VALUES
} ('$regexp', '$filter_type','".$_SESSION["uid"]."',
$feed_id, '$action_id', '$action_param', $inverse)");
$result = db_query($link, print_notice(T_sprintf("Created filter <b>%s</b>", htmlspecialchars($regexp)));
"INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id,
action_id, action_param, inverse)
VALUES
('$regexp', '$filter_type','".$_SESSION["uid"]."',
$feed_id, '$action_id', '$action_param', $inverse)");
}
} }
if ($quiet) return; if ($quiet) return;

View file

@ -68,14 +68,14 @@
$login = db_escape_string(trim($_GET["login"])); $login = db_escape_string(trim($_GET["login"]));
$uid = db_escape_string($_GET["id"]); $uid = db_escape_string($_GET["id"]);
$access_level = sprintf("%d", $_GET["access_level"]); $access_level = (int) $_GET["access_level"];
$email = db_escape_string(trim($_GET["email"])); $email = db_escape_string(trim($_GET["email"]));
$password = db_escape_string(trim($_GET["password"])); $password = db_escape_string(trim($_GET["password"]));
if ($password) { if ($password) {
$pwd_hash = 'SHA1:' . sha1($password); $pwd_hash = 'SHA1:' . sha1($password);
$pass_query_part = "pwd_hash = '$pwd_hash', "; $pass_query_part = "pwd_hash = '$pwd_hash', ";
print format_notice(sprintf(__('Changed password of user <b>%s</b>.'), $login)); print_notice(T_sprintf('Changed password of user <b>%s</b>.', $login));
} else { } else {
$pass_query_part = ""; $pass_query_part = "";
} }
@ -120,21 +120,18 @@
$new_uid = db_fetch_result($result, 0, "id"); $new_uid = db_fetch_result($result, 0, "id");
print format_notice(sprintf(__("Added user <b>%s</b> print_notice(T_sprintf("Added user <b>%s</b> with password <b>%s</b>",
with password <b>%s</b>"), $login, $tmp_user_pwd)); $login, $tmp_user_pwd));
initialize_user($link, $new_uid); initialize_user($link, $new_uid);
} else { } else {
print format_warning(sprintf(__("Could not create user <b>%s</b>"), print_warning(T_sprintf("Could not create user <b>%s</b>", $login));
$login));
} }
} else { } else {
print format_warning(sprintf(__("User <b>%s</b> already exists."), print_warning(T_sprintf("User <b>%s</b> already exists.", $login));
$login));
} }
} }
} else if ($subop == "resetPass") { } else if ($subop == "resetPass") {
@ -154,8 +151,8 @@
db_query($link, "UPDATE ttrss_users SET pwd_hash = '$pwd_hash' db_query($link, "UPDATE ttrss_users SET pwd_hash = '$pwd_hash'
WHERE id = '$uid'"); WHERE id = '$uid'");
print format_notice(sprintf(__("Changed password of user <b>%s</b> print_notice(T_sprintf("Changed password of user <b>%s</b>
to <b>%s</b>"), $login, $tmp_user_pwd)); to <b>%s</b>", $login, $tmp_user_pwd));
if (MAIL_RESET_PASS && $email) { if (MAIL_RESET_PASS && $email) {
print " Notifying <b>$email</b>."; print " Notifying <b>$email</b>.";

View file

@ -107,11 +107,11 @@
<h1>".__('OPML Utility')."</h1>"; <h1>".__('OPML Utility')."</h1>";
if (function_exists('domxml_open_file')) { if (function_exists('domxml_open_file')) {
print __("<p>Importing OPML (using DOMXML extension)...</p>"); print "<p>".__("Importing OPML (using DOMXML extension)...")."</p>");
require_once "modules/opml_domxml.php"; require_once "modules/opml_domxml.php";
opml_import_domxml($link, $owner_uid); opml_import_domxml($link, $owner_uid);
} else { } else {
print __("<p>Importing OPML (using DOMDocument extension)...</p>"); print "<p>".__("Importing OPML (using DOMDocument extension)...")."</p>");
require_once "modules/opml_domdoc.php"; require_once "modules/opml_domdoc.php";
opml_import_domdoc($link, $owner_uid); opml_import_domdoc($link, $owner_uid);
} }

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
TEMPLATE=messages.pot TEMPLATE=messages.pot
xgettext -kT_ngettext:1,2 -k__ -L PHP -o $TEMPLATE *.php modules/*.php xgettext -kT_sprintf -kT_ngettext:1,2 -k__ -L PHP -o $TEMPLATE *.php modules/*.php
update_lang() { update_lang() {
if [ -f $1.po ]; then if [ -f $1.po ]; then