From 0cbe7cf6ecb5e6f28ec5f808796386d4c13959db Mon Sep 17 00:00:00 2001 From: kudlav Date: Thu, 11 Jun 2020 20:45:21 +0200 Subject: [PATCH] Internationalize plugin --- anti-spam-info.php | 65 +++++++++++---------- anti-spam-settings.php | 59 +++++++++++++------ anti-spam.php | 26 ++++++--- languages/anti-spam-reloaded-cs_CZ.mo | Bin 0 -> 1728 bytes languages/anti-spam-reloaded-cs_CZ.po | 80 ++++++++++++++++++++++++++ languages/anti-spam-reloaded.pot | 77 +++++++++++++++++++++++++ 6 files changed, 250 insertions(+), 57 deletions(-) create mode 100644 languages/anti-spam-reloaded-cs_CZ.mo create mode 100644 languages/anti-spam-reloaded-cs_CZ.po create mode 100644 languages/anti-spam-reloaded.pot diff --git a/anti-spam-info.php b/anti-spam-info.php index 5f17caa..e808a72 100644 --- a/anti-spam-info.php +++ b/anti-spam-info.php @@ -16,15 +16,22 @@ function antispamrel_admin_notice() { $blocked_total = 0; // show 0 by default $antispam_stats = get_option('antispamrel_stats', array()); if (isset($antispam_stats['blocked_total'])) { - $blocked_total = esc_html($antispam_stats['blocked_total']); + $blocked_total = $antispam_stats['blocked_total']; } - ?> -
-

- spam comments were blocked by Anti-spam Reloaded plugin so far. -

-
-

' . + /* translators: 1: number of blocked comments, 2: plugin name. */ + _n( + '%1$s spam comment was blocked by %2$s plugin so far', + '%1$s spam comments were blocked by %2$s plugin so far', + $blocked_total, + 'anti-spam-reloaded' + ) . + '

', + number_format_i18n($blocked_total), + 'Anti-spam Reloaded' + )); } } } @@ -40,28 +47,28 @@ function antispamrel_display_screen_option() { $checked = checked(($antispam_info_visibility == 1 || $antispam_info_visibility == ''), true, false); $nonce = esc_textarea(wp_create_nonce('antispamrel_info_nonce')); - ?> -
-
- Anti-spam Reloaded - - - -
-
- - + '; } } diff --git a/anti-spam-settings.php b/anti-spam-settings.php index ce27db6..0bcd32b 100644 --- a/anti-spam-settings.php +++ b/anti-spam-settings.php @@ -20,7 +20,7 @@ function antispamrel_admin_init() { add_settings_section('antispamrel_settings_automatic_section', '', 'antispamrel_section_callback', 'antispamrel_automatic_page'); - add_settings_field('save_spam_comments', 'Save spam comments', 'antispamrel_field_save_spam_comments_callback', 'antispamrel_automatic_page', 'antispamrel_settings_automatic_section'); + add_settings_field('save_spam_comments', __('Save spam comments', 'anti-spam-reloaded'), 'antispamrel_field_save_spam_comments_callback', 'antispamrel_automatic_page', 'antispamrel_settings_automatic_section'); } add_action('admin_init', 'antispamrel_admin_init'); @@ -39,9 +39,17 @@ function antispamrel_section_callback() { // Anti-spam settings description function antispamrel_field_save_spam_comments_callback() { $settings = antispamrel_get_settings(); - echo '', - '

Useful for testing how the plugin works. View spam section.

'; + $checked = checked(1, $settings['save_spam_comments'], false); + echo ' + ', + '

', esc_html__('Useful for testing how the plugin works', 'anti-spam-reloaded'), '. ', + '', + esc_html__('View spam section', 'anti-spam-reloaded'), + '. +

'; } @@ -49,22 +57,35 @@ function antispamrel_settings() { $blocked_total = 0; // show 0 by default $antispam_stats = get_option('antispamrel_stats', array()); if (isset($antispam_stats['blocked_total'])) { - $blocked_total = esc_html($antispam_stats['blocked_total']); + $blocked_total = $antispam_stats['blocked_total']; } + ?> -
-

Anti-spam Reloaded

-

- - spam comments were blocked by Anti-spam Reloaded -

-
- -
-
+
+

Anti-spam Reloaded

+

+ + Anti-spam Reloaded' + )); + ?> +

+
+ +
+

- - - + + +

- '; // empty field (hidden with css); trap for spammers because many bots will try to put email or url here + ', 'ignore me'); + // empty field (hidden with css): trap for spammers because many bots will try to put email or url here } } add_action('comment_form', 'antispamrel_form_part'); // add anti-spam inputs to the comment form @@ -63,10 +71,10 @@ function antispamrel_check_comment($commentdata) { switch ($commentdata['comment_type']) { case '': // comment if(!is_user_logged_in() && antispamrel_check_for_spam()) // logged in user is not a spammer - $flag = 'Comment is a spam.'; + $flag = __('Comment is a spam.', 'anti-spam-reloaded'); break; case 'trackback': - $flag = 'Trackbacks are disabled.'; + $flag = __('Trackbacks are disabled.', 'anti-spam-reloaded'); } if ($flag !== null) { @@ -87,7 +95,7 @@ function antispamrel_check_comment($commentdata) { function antispamrel_plugin_meta($links, $file) { // add some links to plugin meta row if ( $file == plugin_basename( __FILE__ ) ) { $row_meta = array( - 'github' => '' . __( 'Github', 'github' ) . '' + 'github' => 'GitHub' ); $links = array_merge( $links, $row_meta ); } diff --git a/languages/anti-spam-reloaded-cs_CZ.mo b/languages/anti-spam-reloaded-cs_CZ.mo new file mode 100644 index 0000000000000000000000000000000000000000..6914b024b8c1e109b636a01b03d3b47d8a23a250 GIT binary patch literal 1728 zcmcJP&u<$=6vu~B5Hb>iA{7vzzC%+IHM_Rc9x4X|A^kx`16Gq%sF!MXckEs7dS*2< zYvXX>FX#<~dc%SXNTFOfrkAbHNc;gDkvQ=OaN#>yyADl7Ppq{1?3o;1@BvUzjp?n)n^t=@ae%m1%3lQ2mUy-e+FNIU4o~<-#`NY1l{`D3C7NXZ-ZyR z55d>L0DK4h0(5(S2R6W8z&F4@X5;Kx##$~GIKlYV$tvz&;0v%%K+LP)i{Q)P8PMg? z0Gr?zNZ^;C4}J@t2Y&_M1pfxzzOOxB>Hi442>TA`bbJLmeLsP0sd?6r$@zdnH5dqK zX~Yc$nF>=8Q81>ZH7v-pqL)ZAin?4M_c1gQT0F&TL)yeU-07ys6puv2Hu5|hv(4GY zi6MR{#b=v^)=tY0Z4myQ%Ye={!9vU7a}x z1CO+bGCuTsiH(cEPgI>%Bda)*V3=5r3U@yBZi-=IkehdzThXHP4Lr52>swd6TSB{u z7B&4wZBt2$!h1X89ILGO+(HCTTo%t4a?{izE_(Y1$XoT^;b*UY68uQ*(vhrv|lX8TNZ^TBCF4NYcA)y69$_m|0s{ zuYKlS6H;hym2T0sOxcbrQT>A7@Eab_@|f3daM>$(528bJXY+Qgqg5ZL>0OT&2|^TZ zu_2F+-$e{w7DH4wKWu_!s|%T~)T+ClDmPe8ruWbh8AZwz5$)m3RjP*NM9vOZ3=X^H zaUV3slbpu??KQpc+|=>S)MI|fb737-Odpi{mVLYs-mf~rXB(+4%1I{6ebQ>lq*yIQ z7+W-$LL=lV!)4XwWG|BC4{Ul+PVjM1-PR#3N>T2Iu}`!4$)f3YGc|pX*hlr@2y?_u zu%|6R%49?u3fjhhiQQI#=6eX3tA}^Rzv3Q*@sY^W`-{dLQ{Sip8d4= 2 && n <= 4) ? 1 : 2);\n" +"X-Generator: GlotPress/3.0.0-alpha\n" +"Language: cs_CZ\n" +"Project-Id-Version: Plugins - Anti-spam Reloaded - Development (trunk)\n" + +#: anti-spam-info.php:59 +msgid "Apply" +msgstr "Použít" + +#: anti-spam-info.php:57 +msgid "Show number of blocked comments" +msgstr "Zobrazit počet zablokovaných komentářů" + +#. translators: 1: number of blocked comments, 2: plugin name. +#: anti-spam-settings.php:71 anti-spam-info.php:25 +msgid "%1$s spam comment was blocked by %2$s plugin so far" +msgid_plural "%1$s spam comments were blocked by %2$s plugin so far" +msgstr[0] "%1$s komentář byl dosud zablokován pluginem %2$s" +msgstr[1] "%1$s komentáře byl dosud zablokovány pluginem %2$s" +msgstr[2] "%1$s komentářů bylo dosud zablokováno pluginem %2$s" + +#: anti-spam-settings.php:50 +msgid "View spam section" +msgstr "Přejít na sekci Spam" + +#: anti-spam-settings.php:48 +msgid "Useful for testing how the plugin works" +msgstr "Užitečné pro vyzkoušení, jak plugin funguje" + +#: anti-spam-settings.php:46 +msgid "Save spam comments into spam section" +msgstr "Uložit zablokované komentáře do sekce Spam" + +#: anti-spam-settings.php:23 +msgid "Save spam comments" +msgstr "Uložit zablokované komentáře" + +#: anti-spam.php:74 +msgid "Trackbacks are disabled." +msgstr "Trackbacky jsou zakázané." + +#: anti-spam.php:71 +msgid "Comment is a spam." +msgstr "Komentář je spam." + +#: anti-spam.php:53 +msgid "Leave this field empty" +msgstr "Ponechte toto pole prázdné" + +#: anti-spam.php:48 +msgid "Current ye%s@r" +msgstr "Aktuální ro%sk" + +#. Author URI of the plugin +msgid "https://kudlav.github.io/" +msgstr "https://kudlav.github.io/" + +#. Author of the plugin +msgid "kudlav, webvitaly" +msgstr "kudlav, webvitaly" + +#. Description of the plugin +msgid "No spam in comments. No captcha." +msgstr "Žádný spam v komentářích. Žádná captcha." + +#. Plugin URI of the plugin +msgid "http://wordpress.org/plugins/anti-spam-reloaded/" +msgstr "https://cs.wordpress.org/plugins/anti-spam-reloaded/" + +#. Plugin Name of the plugin +msgid "Anti-spam Reloaded" +msgstr "Anti-spam Reloaded" \ No newline at end of file diff --git a/languages/anti-spam-reloaded.pot b/languages/anti-spam-reloaded.pot new file mode 100644 index 0000000..514a052 --- /dev/null +++ b/languages/anti-spam-reloaded.pot @@ -0,0 +1,77 @@ +# Copyright (C) 2020 kudlav, webvitaly +# This file is distributed under the same license as the Anti-spam Reloaded plugin. +msgid "" +msgstr "" +"PO-Revision-Date: +0000\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: GlotPress/3.0.0-alpha\n" +"Project-Id-Version: Plugins - Anti-spam Reloaded - Development (trunk)\n" + +#: anti-spam-info.php:59 +msgid "Apply" +msgstr "" + +#: anti-spam-info.php:57 +msgid "Show number of blocked comments" +msgstr "" + +#. translators: 1: number of blocked comments, 2: plugin name. +#: anti-spam-settings.php:71 anti-spam-info.php:25 +msgid "%1$s spam comment was blocked by %2$s plugin so far" +msgid_plural "%1$s spam comments were blocked by %2$s plugin so far" +msgstr[0] "" +msgstr[1] "" + +#: anti-spam-settings.php:50 +msgid "View spam section" +msgstr "" + +#: anti-spam-settings.php:48 +msgid "Useful for testing how the plugin works" +msgstr "" + +#: anti-spam-settings.php:46 +msgid "Save spam comments into spam section" +msgstr "" + +#: anti-spam-settings.php:23 +msgid "Save spam comments" +msgstr "" + +#: anti-spam.php:74 +msgid "Trackbacks are disabled." +msgstr "" + +#: anti-spam.php:71 +msgid "Comment is a spam." +msgstr "" + +#: anti-spam.php:53 +msgid "Leave this field empty" +msgstr "" + +#: anti-spam.php:48 +msgid "Current ye%s@r" +msgstr "" + +#. Author URI of the plugin +msgid "https://kudlav.github.io/" +msgstr "" + +#. Author of the plugin +msgid "kudlav, webvitaly" +msgstr "" + +#. Description of the plugin +msgid "No spam in comments. No captcha." +msgstr "" + +#. Plugin URI of the plugin +msgid "http://wordpress.org/plugins/anti-spam-reloaded/" +msgstr "" + +#. Plugin Name of the plugin +msgid "Anti-spam Reloaded" +msgstr "" \ No newline at end of file