js: add initial i18n stuff

This commit is contained in:
Andrew Dolgov 2007-03-06 07:54:47 +01:00
parent ac7bcd7135
commit f3977cf5f4
7 changed files with 338 additions and 92 deletions

View File

@ -140,6 +140,10 @@ function notify_real(msg, no_hide, n_type) {
*/ */
if (typeof __ != 'undefined') {
msg = __(msg);
}
if (n_type == 1) { if (n_type == 1) {
n.className = "notify"; n.className = "notify";
} else if (n_type == 2) { } else if (n_type == 2) {

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-06 12:13+0300\n" "POT-Creation-Date: 2007-03-06 12:53+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"
@ -160,150 +160,343 @@ msgid ""
"\t\tofficial site for more information." "\t\tofficial site for more information."
msgstr "" msgstr ""
#: functions.php:2009 functions.php:2048 functions.php:2322 functions.php:3001 #: functions.php:2009 functions.php:2048 functions.php:2325 functions.php:3004
#: functions.php:3031 #: functions.php:3034
msgid "Uncategorized" msgid "Uncategorized"
msgstr "" msgstr ""
#: functions.php:2038 functions.php:2852 #: functions.php:2038 functions.php:2855
msgid "Special" msgid "Special"
msgstr "Особые" msgstr "Особые"
#: functions.php:2040 functions.php:2878 #: functions.php:2040 functions.php:2881
msgid "Labels" msgid "Labels"
msgstr "Метки" msgstr "Метки"
#: functions.php:2058 functions.php:2344 functions.php:2862 #: functions.php:2058 functions.php:2347 functions.php:2865
msgid "Starred articles" msgid "Starred articles"
msgstr "Отмеченные статьи" msgstr "Отмеченные статьи"
#: functions.php:2308 #: functions.php:2311
msgid "Global search results" msgid "Global search results"
msgstr "Результаты поиска" msgstr "Результаты поиска"
#: functions.php:2310 #: functions.php:2313
msgid "Tag search results" msgid "Tag search results"
msgstr "Результаты поиска" msgstr "Результаты поиска"
#: functions.php:2326 #: functions.php:2329
msgid "Category search results" msgid "Category search results"
msgstr "Результаты поиска" msgstr "Результаты поиска"
#: functions.php:2339 #: functions.php:2342
msgid "Feed search results" msgid "Feed search results"
msgstr "Результаты поиска" msgstr "Результаты поиска"
#: functions.php:2352 #: functions.php:2355
msgid "Label search results" msgid "Label search results"
msgstr "Результаты поиска" msgstr "Результаты поиска"
#: functions.php:2547 #: functions.php:2550
msgid "New headlines for last 24 hours, as of " msgid "New headlines for last 24 hours, as of "
msgstr "Новые заголовки за последние 24 часа, на " msgstr "Новые заголовки за последние 24 часа, на "
#: functions.php:2591 #: functions.php:2594
msgid "" msgid ""
"You have been sent this email because you have enabled daily digests in Tiny " "You have been sent this email because you have enabled daily digests in Tiny "
"Tiny RSS at " "Tiny RSS at "
msgstr "" msgstr ""
#: functions.php:2593 #: functions.php:2596
msgid "" msgid ""
"To unsubscribe, visit your configuration options or contact instance owner.\n" "To unsubscribe, visit your configuration options or contact instance owner.\n"
msgstr "" msgstr ""
#: functions.php:2760 functions.php:2789 #: functions.php:2763 functions.php:2792
msgid "All" msgid "All"
msgstr "Все" msgstr "Все"
#: functions.php:2761 functions.php:2790 functions.php:2793 tt-rss.php:164 #: functions.php:2764 functions.php:2793 functions.php:2796 tt-rss.php:164
msgid "Unread" msgid "Unread"
msgstr "Новые" msgstr "Новые"
#: functions.php:2762 functions.php:2791 #: functions.php:2765 functions.php:2794
msgid "None" msgid "None"
msgstr "" msgstr ""
#: functions.php:2765 #: functions.php:2768
msgid "Toggle unread" msgid "Toggle unread"
msgstr "" msgstr ""
#: functions.php:2766 #: functions.php:2769
msgid "Toggle starred" msgid "Toggle starred"
msgstr "" msgstr ""
#: functions.php:2768 #: functions.php:2771
msgid "Mark as read" msgid "Mark as read"
msgstr "Как прочитанные" msgstr "Как прочитанные"
#: functions.php:2769 #: functions.php:2772
msgid "This page" msgid "This page"
msgstr "Эту страницу" msgstr "Эту страницу"
#: functions.php:2770 #: functions.php:2773
msgid "Entire feed" msgid "Entire feed"
msgstr "Весь фид" msgstr "Весь фид"
#: functions.php:2775 #: functions.php:2778
msgid "Next page" msgid "Next page"
msgstr "" msgstr ""
#: functions.php:2776 #: functions.php:2779
msgid "Previous page" msgid "Previous page"
msgstr "" msgstr ""
#: functions.php:2777 #: functions.php:2780
msgid "First page" msgid "First page"
msgstr "" msgstr ""
#: functions.php:2788 #: functions.php:2791
msgid "Select:" msgid "Select:"
msgstr "Выбрать:" msgstr "Выбрать:"
#: functions.php:2793 #: functions.php:2796
msgid "Toggle:" msgid "Toggle:"
msgstr "Изменить:" msgstr "Изменить:"
#: functions.php:2794 tt-rss.php:163 #: functions.php:2797 tt-rss.php:163
msgid "Starred" msgid "Starred"
msgstr "Отмеченные" msgstr "Отмеченные"
#: functions.php:2796 #: functions.php:2799
msgid "Mark as read:" msgid "Mark as read:"
msgstr "" msgstr ""
#: functions.php:2797 #: functions.php:2800
msgid "Page" msgid "Page"
msgstr "Страница" msgstr "Страница"
#: functions.php:2798 modules/pref-filters.php:261 #: functions.php:2801 modules/pref-filters.php:261
msgid "Feed" msgid "Feed"
msgstr "" msgstr ""
#: functions.php:2807 #: functions.php:2810
msgid "Convert to Label" msgid "Convert to Label"
msgstr "" msgstr ""
#: functions.php:2834 #: functions.php:2837
msgid "Generated feed" msgid "Generated feed"
msgstr "" msgstr ""
#: functions.php:3071 #: functions.php:3074
msgid "No feeds to display." msgid "No feeds to display."
msgstr "" msgstr ""
#: functions.php:3088 #: functions.php:3091
msgid "Tags" msgid "Tags"
msgstr "" msgstr ""
#: localized_js.php:22 #: localized_js.php:29
msgid "display feeds" msgid "display feeds"
msgstr "показать фиды" msgstr "показать фиды"
#: localized_js.php:23 tt-rss.php:121 #: localized_js.php:30 tt-rss.php:121
msgid "display tags" msgid "display tags"
msgstr "показать теги" msgstr "показать теги"
#: localized_js.php:31 prefs.php:123 tt-rss.php:77
msgid "Loading, please wait..."
msgstr "Идет загрузка..."
#: localized_js.php:32
msgid "All feeds updated."
msgstr ""
#: localized_js.php:33
#, fuzzy
msgid "Marking all feeds as read..."
msgstr "Как прочитанные"
#: localized_js.php:34
msgid "Adding feed..."
msgstr ""
#: localized_js.php:35
msgid "Removing feed..."
msgstr ""
#: localized_js.php:36
msgid "Saving feed..."
msgstr ""
#: localized_js.php:37
msgid "Can't add category: no name specified."
msgstr ""
#: localized_js.php:38
msgid "Adding feed category..."
msgstr ""
#: localized_js.php:39
msgid "Can't add user: no login specified."
msgstr ""
#: localized_js.php:41
msgid "Adding user..."
msgstr ""
#: localized_js.php:42
msgid "Can't create label: missing SQL expression."
msgstr ""
#: localized_js.php:43
msgid "Can't create label: missing caption."
msgstr ""
#: localized_js.php:44
msgid "Remove selected labels?"
msgstr ""
#: localized_js.php:45
msgid "Removing selected labels..."
msgstr ""
#: localized_js.php:46 localized_js.php:65
#, fuzzy
msgid "No labels are selected."
msgstr "Категории отсутствуют."
#: localized_js.php:47
msgid "Remove selected users?"
msgstr ""
#: localized_js.php:48
msgid "Removing selected users..."
msgstr ""
#: localized_js.php:49 localized_js.php:67 localized_js.php:69
msgid "No users are selected."
msgstr ""
#: localized_js.php:50
msgid "Remove selected filters?"
msgstr ""
#: localized_js.php:51
msgid "Removing selected filters..."
msgstr ""
#: localized_js.php:52 localized_js.php:75
#, fuzzy
msgid "No filters are selected."
msgstr "Категории отсутствуют."
#: localized_js.php:53
msgid "Unsubscribe from selected feeds?"
msgstr ""
#: localized_js.php:54
msgid "Unsubscribing from selected feeds..."
msgstr ""
#: localized_js.php:55 localized_js.php:73 localized_js.php:77
#, fuzzy
msgid "No feeds are selected."
msgstr "Категории отсутствуют."
#: localized_js.php:56
msgid "Remove selected categories?"
msgstr ""
#: localized_js.php:57
msgid "Removing selected categories..."
msgstr ""
#: localized_js.php:58 localized_js.php:79
#, fuzzy
msgid "No categories are selected."
msgstr "Категории отсутствуют."
#: localized_js.php:59
#, fuzzy
msgid "Saving category..."
msgstr "Создать категорию"
#: localized_js.php:60
msgid "Loading help..."
msgstr ""
#: localized_js.php:61
msgid "Saving label..."
msgstr ""
#: localized_js.php:62
msgid "Login field cannot be blank."
msgstr ""
#: localized_js.php:63
msgid "Saving user..."
msgstr ""
#: localized_js.php:64
msgid "Saving filter..."
msgstr ""
#: localized_js.php:66
msgid "Please select only one label."
msgstr ""
#: localized_js.php:68 localized_js.php:70
msgid "Please select only one user."
msgstr ""
#: localized_js.php:71
#, fuzzy
msgid "Reset password of selected user?"
msgstr "Пароль"
#: localized_js.php:72
msgid "Resetting password for selected user..."
msgstr ""
#: localized_js.php:74
msgid "Please select only one feed."
msgstr ""
#: localized_js.php:76
msgid "Please select only one filter."
msgstr ""
#: localized_js.php:78
msgid "Please select one feed."
msgstr ""
#: localized_js.php:80
msgid "Please select only one category."
msgstr ""
#: localized_js.php:81
msgid "No OPML file to upload."
msgstr ""
#: localized_js.php:82
msgid "Changing category of selected feeds..."
msgstr ""
#: localized_js.php:83
#, fuzzy
msgid "Reset to defaults?"
msgstr "По умолчанию"
#: localized_js.php:84
#, fuzzy
msgid "Trying to change password..."
msgstr "Пароль"
#: localized_js.php:85
msgid "Trying to change e-mail..."
msgstr ""
#: login_form.php:49 modules/pref-feeds.php:264 modules/pref-users.php:29 #: login_form.php:49 modules/pref-feeds.php:264 modules/pref-users.php:29
msgid "Login:" msgid "Login:"
msgstr "Пользователь:" msgstr "Пользователь:"
@ -328,47 +521,43 @@ msgstr ""
msgid "Return to preferences" msgid "Return to preferences"
msgstr "" msgstr ""
#: prefs.php:83 #: prefs.php:84
msgid "Unknown Error" msgid "Unknown Error"
msgstr "" msgstr ""
#: prefs.php:89 tt-rss.php:108 #: prefs.php:90 tt-rss.php:108
msgid "Hello," msgid "Hello,"
msgstr "Превед," msgstr "Превед,"
#: prefs.php:90 tt-rss.php:109 #: prefs.php:91 tt-rss.php:109
msgid "Logout" msgid "Logout"
msgstr "Выход" msgstr "Выход"
#: prefs.php:103 tt-rss.php:132 #: prefs.php:104 tt-rss.php:132
msgid "Preferences" msgid "Preferences"
msgstr "Настройки" msgstr "Настройки"
#: prefs.php:105 #: prefs.php:106
msgid "My Feeds" msgid "My Feeds"
msgstr "" msgstr ""
#: prefs.php:108 #: prefs.php:109
msgid "Other Feeds" msgid "Other Feeds"
msgstr "" msgstr ""
#: prefs.php:111 #: prefs.php:112
msgid "Content Filtering" msgid "Content Filtering"
msgstr "" msgstr ""
#: prefs.php:114 #: prefs.php:115
msgid "Label Editor" msgid "Label Editor"
msgstr "" msgstr ""
#: prefs.php:118 #: prefs.php:119
msgid "User Manager" msgid "User Manager"
msgstr "" msgstr ""
#: prefs.php:122 tt-rss.php:77 #: prefs.php:126 tt-rss.php:80
msgid "Loading, please wait..."
msgstr ""
#: prefs.php:125 tt-rss.php:80
msgid "" msgid ""
"Your browser doesn't support Javascript, which is required\n" "Your browser doesn't support Javascript, which is required\n"
"\t\tfor this application to function properly. Please check your\n" "\t\tfor this application to function properly. Please check your\n"

View File

@ -2,8 +2,17 @@
require "functions.php"; require "functions.php";
header("Content-Type: text/plain; charset=UTF-8"); header("Content-Type: text/plain; charset=UTF-8");
function js_decl($s1, $s2) { function T_js_decl($s1) {
return "T_messages[\"$s1\"] = \"$s2\";\n";
if (!$s1) return;
$T_s1 = __($s1);
if ($T_s1 != $s1) {
return "T_messages[\"$s1\"] = \"".__($s1)."\";\n";
} else {
return "";
}
} }
?> ?>
@ -13,14 +22,69 @@ function __(msg) {
if (T_messages[msg]) { if (T_messages[msg]) {
return T_messages[msg]; return T_messages[msg];
} else { } else {
debug('[gettext] not found: ' + msg);
return msg; return msg;
} }
} }
<?php <?php
print js_decl("display feeds", __("display feeds")); print T_js_decl("display feeds");
print js_decl("display tags", __("display tags")); print T_js_decl("display tags");
print T_js_decl("Loading, please wait...");
print T_js_decl("All feeds updated.");
print T_js_decl("Marking all feeds as read...");
print T_js_decl("Adding feed...");
print T_js_decl("Removing feed...");
print T_js_decl("Saving feed...");
print T_js_decl("Can't add category: no name specified.");
print T_js_decl("Adding feed category...");
print T_js_decl("Can't add user: no login specified.");
print T_js_decl("Adding user...");
print T_js_decl("Can't create label: missing SQL expression.");
print T_js_decl("Can't create label: missing caption.");
print T_js_decl("Remove selected labels?");
print T_js_decl("Removing selected labels...");
print T_js_decl("No labels are selected.");
print T_js_decl("Remove selected users?");
print T_js_decl("Removing selected users...");
print T_js_decl("No users are selected.");
print T_js_decl("Remove selected filters?");
print T_js_decl("Removing selected filters...");
print T_js_decl("No filters are selected.");
print T_js_decl("Unsubscribe from selected feeds?");
print T_js_decl("Unsubscribing from selected feeds...");
print T_js_decl("No feeds are selected.");
print T_js_decl("Remove selected categories?");
print T_js_decl("Removing selected categories...");
print T_js_decl("No categories are selected.");
print T_js_decl("Saving category...");
print T_js_decl("Loading help...");
print T_js_decl("Saving label...");
print T_js_decl("Login field cannot be blank.");
print T_js_decl("Saving user...");
print T_js_decl("Saving filter...");
print T_js_decl("No labels are selected.");
print T_js_decl("Please select only one label.");
print T_js_decl("No users are selected.");
print T_js_decl("Please select only one user.");
print T_js_decl("No users are selected.");
print T_js_decl("Please select only one user.");
print T_js_decl("Reset password of selected user?");
print T_js_decl("Resetting password for selected user...");
print T_js_decl("No feeds are selected.");
print T_js_decl("Please select only one feed.");
print T_js_decl("No filters are selected.");
print T_js_decl("Please select only one filter.");
print T_js_decl("No feeds are selected.");
print T_js_decl("Please select one feed.");
print T_js_decl("No categories are selected.");
print T_js_decl("Please select only one category.");
print T_js_decl("No OPML file to upload.");
print T_js_decl("Changing category of selected feeds...");
print T_js_decl("Reset to defaults?");
print T_js_decl("Trying to change password...");
print T_js_decl("Trying to change e-mail...");
?> ?>

View File

@ -231,9 +231,9 @@ function addFeed() {
var link = document.getElementById("fadd_link"); var link = document.getElementById("fadd_link");
if (link.value.length == 0) { if (link.value.length == 0) {
alert("Error: No feed URL given."); alert(__("Error: No feed URL given."));
} else if (!isValidURL(link.value)) { } else if (!isValidURL(link.value)) {
alert("Error: Invalid feed URL."); alert(__("Error: Invalid feed URL."));
} else { } else {
notify_progress("Adding feed..."); notify_progress("Adding feed...");
@ -258,7 +258,7 @@ function addFeedCat() {
var cat = document.getElementById("fadd_cat"); var cat = document.getElementById("fadd_cat");
if (cat.value.length == 0) { if (cat.value.length == 0) {
alert("Can't add category: no name specified."); alert(__("Can't add category: no name specified."));
} else { } else {
notify_progress("Adding feed category..."); notify_progress("Adding feed category...");
@ -858,12 +858,12 @@ function editSelectedLabel() {
var rows = getSelectedLabels(); var rows = getSelectedLabels();
if (rows.length == 0) { if (rows.length == 0) {
alert("No labels are selected."); alert(__("No labels are selected."));
return; return;
} }
if (rows.length > 1) { if (rows.length > 1) {
alert("Please select only one label."); alert(__("Please select only one label."));
return; return;
} }
@ -877,12 +877,12 @@ function editSelectedUser() {
var rows = getSelectedUsers(); var rows = getSelectedUsers();
if (rows.length == 0) { if (rows.length == 0) {
alert("No users are selected."); alert(__("No users are selected."));
return; return;
} }
if (rows.length > 1) { if (rows.length > 1) {
alert("Please select only one user."); alert(__("Please select only one user."));
return; return;
} }
@ -895,16 +895,16 @@ function resetSelectedUserPass() {
var rows = getSelectedUsers(); var rows = getSelectedUsers();
if (rows.length == 0) { if (rows.length == 0) {
alert("No users are selected."); alert(__("No users are selected."));
return; return;
} }
if (rows.length > 1) { if (rows.length > 1) {
alert("Please select only one user."); alert(__("Please select only one user."));
return; return;
} }
var ok = confirm("Reset password of selected user?"); var ok = confirm(__("Reset password of selected user?"));
if (ok) { if (ok) {
notify_progress("Resetting password for selected user..."); notify_progress("Resetting password for selected user...");
@ -928,12 +928,12 @@ function selectedUserDetails() {
var rows = getSelectedUsers(); var rows = getSelectedUsers();
if (rows.length == 0) { if (rows.length == 0) {
alert("No users are selected."); alert(__("No users are selected."));
return; return;
} }
if (rows.length > 1) { if (rows.length > 1) {
alert("Please select only one user."); alert(__("Please select only one user."));
return; return;
} }
@ -957,12 +957,12 @@ function selectedFeedDetails() {
var rows = getSelectedFeeds(); var rows = getSelectedFeeds();
if (rows.length == 0) { if (rows.length == 0) {
alert("No feeds are selected."); alert(__("No feeds are selected."));
return; return;
} }
if (rows.length > 1) { if (rows.length > 1) {
alert("Please select only one feed."); alert(__("Please select only one feed."));
return; return;
} }
@ -981,12 +981,12 @@ function editSelectedFilter() {
var rows = getSelectedFilters(); var rows = getSelectedFilters();
if (rows.length == 0) { if (rows.length == 0) {
alert("No filters are selected."); alert(__("No filters are selected."));
return; return;
} }
if (rows.length > 1) { if (rows.length > 1) {
alert("Please select only one filter."); alert(__("Please select only one filter."));
return; return;
} }
@ -1001,12 +1001,12 @@ function editSelectedFeed() {
var rows = getSelectedFeeds(); var rows = getSelectedFeeds();
if (rows.length == 0) { if (rows.length == 0) {
alert("No feeds are selected."); alert(__("No feeds are selected."));
return; return;
} }
if (rows.length > 1) { if (rows.length > 1) {
alert("Please select one feed."); alert(__("Please select one feed."));
return; return;
} }
@ -1020,12 +1020,12 @@ function editSelectedFeedCat() {
var rows = getSelectedFeedCats(); var rows = getSelectedFeedCats();
if (rows.length == 0) { if (rows.length == 0) {
alert("No categories are selected."); alert(__("No categories are selected."));
return; return;
} }
if (rows.length > 1) { if (rows.length > 1) {
alert("Please select only one category."); alert(__("Please select only one category."));
return; return;
} }
@ -1100,7 +1100,7 @@ function validateOpmlImport() {
var opml_file = document.getElementById("opml_file"); var opml_file = document.getElementById("opml_file");
if (opml_file.value.length == 0) { if (opml_file.value.length == 0) {
alert("No OPML file to upload."); alert(__("No OPML file to upload."));
return false; return false;
} else { } else {
return true; return true;
@ -1358,14 +1358,14 @@ function categorizeSelectedFeeds() {
} else { } else {
alert("No feeds are selected."); alert(__("No feeds are selected."));
} }
} }
function validatePrefsReset() { function validatePrefsReset() {
return confirm("Reset to defaults?"); return confirm(__("Reset to defaults?"));
} }
function browseFeeds(limit) { function browseFeeds(limit) {
@ -1454,18 +1454,6 @@ function browserToggleExpand(id) {
} }
} }
function validateNewPassword(form) {
if (form.OLD_PASSWORD.value == "") {
alert("Old password cannot be blank");
return false;
}
if (form.NEW_PASSWORD.value == "") {
alert("New password cannot be blank");
return false;
}
return true;
}
function selectPrefRows(kind, select) { function selectPrefRows(kind, select) {
if (kind) { if (kind) {

View File

@ -39,6 +39,7 @@
<link rel="shortcut icon" type="image/png" href="images/favicon.png"> <link rel="shortcut icon" type="image/png" href="images/favicon.png">
<script type="text/javascript" src="prototype.js"></script> <script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="localized_js.php?<?php echo $dt_add ?>"></script>
<script type="text/javascript" src="functions.js?<?php echo $dt_add ?>"></script> <script type="text/javascript" src="functions.js?<?php echo $dt_add ?>"></script>
<script type="text/javascript" src="prefs.js?<?php echo $dt_add ?>"></script> <script type="text/javascript" src="prefs.js?<?php echo $dt_add ?>"></script>

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
TEMPLATE=messages.pot TEMPLATE=messages.pot
xgettext -kT_sprintf -kT_ngettext:1,2 -k__ -L PHP -o $TEMPLATE *.php modules/*.php xgettext -kT_js_decl -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