From f3977cf5f461b5c7e5408ab200e62bcc1dc7272e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 6 Mar 2007 07:54:47 +0100 Subject: [PATCH] js: add initial i18n stuff --- functions.js | 4 + locale/ru_RU/LC_MESSAGES/messages.mo | Bin 3816 -> 3901 bytes locale/ru_RU/LC_MESSAGES/messages.po | 291 ++++++++++++++++++++++----- localized_js.php | 74 ++++++- prefs.js | 58 +++--- prefs.php | 1 + update-translations.sh | 2 +- 7 files changed, 338 insertions(+), 92 deletions(-) diff --git a/functions.js b/functions.js index 7442daa6..b7e633ea 100644 --- a/functions.js +++ b/functions.js @@ -140,6 +140,10 @@ function notify_real(msg, no_hide, n_type) { */ + if (typeof __ != 'undefined') { + msg = __(msg); + } + if (n_type == 1) { n.className = "notify"; } else if (n_type == 2) { diff --git a/locale/ru_RU/LC_MESSAGES/messages.mo b/locale/ru_RU/LC_MESSAGES/messages.mo index ac5d200a6a68dfd71bec58e6b622bb24569b93b8..6aa6f67e021b00766fc585efd0f2a6e82ddbb967 100644 GIT binary patch delta 1404 zcmYM!T}YEr9LMpqwwZHUrY$XV&F0&3F0<5LBm$#^E`qX~>Sol4^=es&^zwvVL@x*h zNziRKcC}cM30}o63ZiF1L{QOXB|&vz5C(mJPlq}@=lPs-p659)|8ura_0v)3Lsj68 zA@!11lIMNK?8SF}ZluI7{)KiW#+gAaNf52=(U=91xBy|HBgVOZ$(XT0GHwk$8g^a8m|(bnIho_|D5=)3i|eI6nV+PX^Af}`jp z*zYz9Ei~+7^v!q?qd18Q`5V-Lv)G6~P#x3|mIiD@y|)7u;{B*CIAfn*MV+AuOyD!r z_g~A{{}mK|(ZFFa5vHvUo2)xgGtOcXhfx!_Z=XL$J~gwbh|Qr6afseEU^D9ZHmt{8 zsQ0qij~B{`{~8Jf8nl9Mr~w1q6v`^3$;43~cA(BcpRMmf4Uj=DGssN~xrF*|3>Arc zsDo%SYM*7;aK)&bQaBw*eaz`xW=i8JhlT>Gq0>rZJF zSxF(^;FbQ~;-GE!meTDN{@>P9RA}4DJ!EZ*Qj)wb9}J%IMbd|}Cyyj!gU2)Jp-gNz wojsdMrShjsW_-S`{Pxl@f8Aa8k^8tf8grkxIX7RtT)aYQ%FXFLH(cxg0}{M=CIA2c delta 1322 zcmXxkPi#z46vy%N%(SL8+ELX(JA+PZj8aCcw3UbmktR(yEJR{qg-94XLEc!3koXr7 z3$c(`R4g76k|B}Uh>Ub2lKPWw8VR-WXCaaJ{+{Dz&ilN3-=BN$x%W*i|2Y?aY)f7@ z$|%uA{0Ph@@O6R%CDmZI44ZH%7H}bM!)6>q-MSAmxE~wwC}y#OO?Vy`;Z>ZEcd^wh zwELW-X{g}>e1-h%Er%q&_x2fFOnnZQU_dYGD9b_hJZgZ0*pB1K&kk`&;SsN&bWdTL z{;kT1MtBj6cmq4}IckQ}*n+dD0sTbX{~I;nB-7#4GN|iWuXiCoE4Y2`fIEsA`nR2& z=!JW+4G(&~f=t#||FZhJ3@GI)R7Sg1(?nb441a*A^wRb95!V9S9AK`L*(MPj_gzMAwFs55XQ+;*y!{L2sQ>co?ew~bdJ)&+3Dm%E zrOCfKdO(9xSVMkR=b#r)qt^bL*Z-h8&hU_)>*Sybl#oj{jLN`n)Ibkl2cGr%HB_b^ zquyT+IqBzQ1~sA#z3DUQL3K2Qt8oYF!Nb^xRb=^W5;gOOZXE;aDtey=!z$TILeJ}+ z{$ m4X^)+0U};JeX}askrwqf91o(&#y3Gwj?SbmC8A=wBk>oV*I&N? diff --git a/locale/ru_RU/LC_MESSAGES/messages.po b/locale/ru_RU/LC_MESSAGES/messages.po index 146a7655..24bc999d 100644 --- a/locale/ru_RU/LC_MESSAGES/messages.po +++ b/locale/ru_RU/LC_MESSAGES/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 1.0\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" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -160,150 +160,343 @@ msgid "" "\t\tofficial site for more information." msgstr "" -#: functions.php:2009 functions.php:2048 functions.php:2322 functions.php:3001 -#: functions.php:3031 +#: functions.php:2009 functions.php:2048 functions.php:2325 functions.php:3004 +#: functions.php:3034 msgid "Uncategorized" msgstr "" -#: functions.php:2038 functions.php:2852 +#: functions.php:2038 functions.php:2855 msgid "Special" msgstr "Особые" -#: functions.php:2040 functions.php:2878 +#: functions.php:2040 functions.php:2881 msgid "Labels" msgstr "Метки" -#: functions.php:2058 functions.php:2344 functions.php:2862 +#: functions.php:2058 functions.php:2347 functions.php:2865 msgid "Starred articles" msgstr "Отмеченные статьи" -#: functions.php:2308 +#: functions.php:2311 msgid "Global search results" msgstr "Результаты поиска" -#: functions.php:2310 +#: functions.php:2313 msgid "Tag search results" msgstr "Результаты поиска" -#: functions.php:2326 +#: functions.php:2329 msgid "Category search results" msgstr "Результаты поиска" -#: functions.php:2339 +#: functions.php:2342 msgid "Feed search results" msgstr "Результаты поиска" -#: functions.php:2352 +#: functions.php:2355 msgid "Label search results" msgstr "Результаты поиска" -#: functions.php:2547 +#: functions.php:2550 msgid "New headlines for last 24 hours, as of " msgstr "Новые заголовки за последние 24 часа, на " -#: functions.php:2591 +#: functions.php:2594 msgid "" "You have been sent this email because you have enabled daily digests in Tiny " "Tiny RSS at " msgstr "" -#: functions.php:2593 +#: functions.php:2596 msgid "" "To unsubscribe, visit your configuration options or contact instance owner.\n" msgstr "" -#: functions.php:2760 functions.php:2789 +#: functions.php:2763 functions.php:2792 msgid "All" 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" msgstr "Новые" -#: functions.php:2762 functions.php:2791 +#: functions.php:2765 functions.php:2794 msgid "None" msgstr "" -#: functions.php:2765 +#: functions.php:2768 msgid "Toggle unread" msgstr "" -#: functions.php:2766 +#: functions.php:2769 msgid "Toggle starred" msgstr "" -#: functions.php:2768 +#: functions.php:2771 msgid "Mark as read" msgstr "Как прочитанные" -#: functions.php:2769 +#: functions.php:2772 msgid "This page" msgstr "Эту страницу" -#: functions.php:2770 +#: functions.php:2773 msgid "Entire feed" msgstr "Весь фид" -#: functions.php:2775 +#: functions.php:2778 msgid "Next page" msgstr "" -#: functions.php:2776 +#: functions.php:2779 msgid "Previous page" msgstr "" -#: functions.php:2777 +#: functions.php:2780 msgid "First page" msgstr "" -#: functions.php:2788 +#: functions.php:2791 msgid "Select:" msgstr "Выбрать:" -#: functions.php:2793 +#: functions.php:2796 msgid "Toggle:" msgstr "Изменить:" -#: functions.php:2794 tt-rss.php:163 +#: functions.php:2797 tt-rss.php:163 msgid "Starred" msgstr "Отмеченные" -#: functions.php:2796 +#: functions.php:2799 msgid "Mark as read:" msgstr "" -#: functions.php:2797 +#: functions.php:2800 msgid "Page" msgstr "Страница" -#: functions.php:2798 modules/pref-filters.php:261 +#: functions.php:2801 modules/pref-filters.php:261 msgid "Feed" msgstr "" -#: functions.php:2807 +#: functions.php:2810 msgid "Convert to Label" msgstr "" -#: functions.php:2834 +#: functions.php:2837 msgid "Generated feed" msgstr "" -#: functions.php:3071 +#: functions.php:3074 msgid "No feeds to display." msgstr "" -#: functions.php:3088 +#: functions.php:3091 msgid "Tags" msgstr "" -#: localized_js.php:22 +#: localized_js.php:29 msgid "display feeds" msgstr "показать фиды" -#: localized_js.php:23 tt-rss.php:121 +#: localized_js.php:30 tt-rss.php:121 msgid "display tags" 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 msgid "Login:" msgstr "Пользователь:" @@ -328,47 +521,43 @@ msgstr "" msgid "Return to preferences" msgstr "" -#: prefs.php:83 +#: prefs.php:84 msgid "Unknown Error" msgstr "" -#: prefs.php:89 tt-rss.php:108 +#: prefs.php:90 tt-rss.php:108 msgid "Hello," msgstr "Превед," -#: prefs.php:90 tt-rss.php:109 +#: prefs.php:91 tt-rss.php:109 msgid "Logout" msgstr "Выход" -#: prefs.php:103 tt-rss.php:132 +#: prefs.php:104 tt-rss.php:132 msgid "Preferences" msgstr "Настройки" -#: prefs.php:105 +#: prefs.php:106 msgid "My Feeds" msgstr "" -#: prefs.php:108 +#: prefs.php:109 msgid "Other Feeds" msgstr "" -#: prefs.php:111 +#: prefs.php:112 msgid "Content Filtering" msgstr "" -#: prefs.php:114 +#: prefs.php:115 msgid "Label Editor" msgstr "" -#: prefs.php:118 +#: prefs.php:119 msgid "User Manager" msgstr "" -#: prefs.php:122 tt-rss.php:77 -msgid "Loading, please wait..." -msgstr "" - -#: prefs.php:125 tt-rss.php:80 +#: prefs.php:126 tt-rss.php:80 msgid "" "Your browser doesn't support Javascript, which is required\n" "\t\tfor this application to function properly. Please check your\n" diff --git a/localized_js.php b/localized_js.php index b46ba83b..0d09b8a9 100644 --- a/localized_js.php +++ b/localized_js.php @@ -2,8 +2,17 @@ require "functions.php"; header("Content-Type: text/plain; charset=UTF-8"); -function js_decl($s1, $s2) { - return "T_messages[\"$s1\"] = \"$s2\";\n"; +function T_js_decl($s1) { + + 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]) { return T_messages[msg]; } else { + debug('[gettext] not found: ' + msg); return msg; } } +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..."); +?> diff --git a/prefs.js b/prefs.js index 25f290c7..a6e5d084 100644 --- a/prefs.js +++ b/prefs.js @@ -231,9 +231,9 @@ function addFeed() { var link = document.getElementById("fadd_link"); if (link.value.length == 0) { - alert("Error: No feed URL given."); + alert(__("Error: No feed URL given.")); } else if (!isValidURL(link.value)) { - alert("Error: Invalid feed URL."); + alert(__("Error: Invalid feed URL.")); } else { notify_progress("Adding feed..."); @@ -258,7 +258,7 @@ function addFeedCat() { var cat = document.getElementById("fadd_cat"); if (cat.value.length == 0) { - alert("Can't add category: no name specified."); + alert(__("Can't add category: no name specified.")); } else { notify_progress("Adding feed category..."); @@ -858,12 +858,12 @@ function editSelectedLabel() { var rows = getSelectedLabels(); if (rows.length == 0) { - alert("No labels are selected."); + alert(__("No labels are selected.")); return; } if (rows.length > 1) { - alert("Please select only one label."); + alert(__("Please select only one label.")); return; } @@ -877,12 +877,12 @@ function editSelectedUser() { var rows = getSelectedUsers(); if (rows.length == 0) { - alert("No users are selected."); + alert(__("No users are selected.")); return; } if (rows.length > 1) { - alert("Please select only one user."); + alert(__("Please select only one user.")); return; } @@ -895,16 +895,16 @@ function resetSelectedUserPass() { var rows = getSelectedUsers(); if (rows.length == 0) { - alert("No users are selected."); + alert(__("No users are selected.")); return; } if (rows.length > 1) { - alert("Please select only one user."); + alert(__("Please select only one user.")); return; } - var ok = confirm("Reset password of selected user?"); + var ok = confirm(__("Reset password of selected user?")); if (ok) { notify_progress("Resetting password for selected user..."); @@ -928,12 +928,12 @@ function selectedUserDetails() { var rows = getSelectedUsers(); if (rows.length == 0) { - alert("No users are selected."); + alert(__("No users are selected.")); return; } if (rows.length > 1) { - alert("Please select only one user."); + alert(__("Please select only one user.")); return; } @@ -957,12 +957,12 @@ function selectedFeedDetails() { var rows = getSelectedFeeds(); if (rows.length == 0) { - alert("No feeds are selected."); + alert(__("No feeds are selected.")); return; } if (rows.length > 1) { - alert("Please select only one feed."); + alert(__("Please select only one feed.")); return; } @@ -981,12 +981,12 @@ function editSelectedFilter() { var rows = getSelectedFilters(); if (rows.length == 0) { - alert("No filters are selected."); + alert(__("No filters are selected.")); return; } if (rows.length > 1) { - alert("Please select only one filter."); + alert(__("Please select only one filter.")); return; } @@ -1001,12 +1001,12 @@ function editSelectedFeed() { var rows = getSelectedFeeds(); if (rows.length == 0) { - alert("No feeds are selected."); + alert(__("No feeds are selected.")); return; } if (rows.length > 1) { - alert("Please select one feed."); + alert(__("Please select one feed.")); return; } @@ -1020,12 +1020,12 @@ function editSelectedFeedCat() { var rows = getSelectedFeedCats(); if (rows.length == 0) { - alert("No categories are selected."); + alert(__("No categories are selected.")); return; } if (rows.length > 1) { - alert("Please select only one category."); + alert(__("Please select only one category.")); return; } @@ -1100,7 +1100,7 @@ function validateOpmlImport() { var opml_file = document.getElementById("opml_file"); if (opml_file.value.length == 0) { - alert("No OPML file to upload."); + alert(__("No OPML file to upload.")); return false; } else { return true; @@ -1358,14 +1358,14 @@ function categorizeSelectedFeeds() { } else { - alert("No feeds are selected."); + alert(__("No feeds are selected.")); } } function validatePrefsReset() { - return confirm("Reset to defaults?"); + return confirm(__("Reset to defaults?")); } 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) { if (kind) { diff --git a/prefs.php b/prefs.php index 1f0a97a8..58f5670c 100644 --- a/prefs.php +++ b/prefs.php @@ -39,6 +39,7 @@ + diff --git a/update-translations.sh b/update-translations.sh index e56cb304..72a822d4 100644 --- a/update-translations.sh +++ b/update-translations.sh @@ -1,7 +1,7 @@ #!/bin/sh 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() { if [ -f $1.po ]; then -- 2.39.2