Skip to content

Commit

Permalink
Make more strings localizable
Browse files Browse the repository at this point in the history
  • Loading branch information
rimas-kudelis committed Dec 21, 2024
1 parent d04e9aa commit 573f727
Show file tree
Hide file tree
Showing 34 changed files with 8,956 additions and 418 deletions.
91 changes: 75 additions & 16 deletions admin/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ function altcha_options_page_html()
</div>

<div style="flex-grow: 1;">
<div class="altcha-title">ALTCHA</div>
<div class="altcha-subtitle">A Privacy-Friendly Captcha Alternative.</div>
<div class="altcha-title"><?php echo esc_html__('ALTCHA', 'altcha-spam-protection'); ?></div>
<div class="altcha-subtitle"><?php echo esc_html__('A Privacy-Friendly Captcha Alternative.', 'altcha-spam-protection'); ?></div>
</div>

<div>
<div style="margin-bottom: 0.3rem;"><b>Do you like ALTCHA?</b></div>
<div style="margin-bottom: 0.3rem;"><b><?php echo esc_html__('Do you like ALTCHA?', 'altcha-spam-protection'); ?></b></div>
<div style="display:flex;gap: 0.5rem;">
<a href="https://wordpress.org/support/plugin/altcha-spam-protection/reviews/?filter=5#new-post" target="_blank" style="display: inline-flex; gap: 0.5rem;">
<span style="display: inline-flex; gap: 0.1rem;">
Expand All @@ -45,7 +45,7 @@ function altcha_options_page_html()
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#FFCC00" width="18" height="18"><path d="M12.0006 18.26L4.94715 22.2082L6.52248 14.2799L0.587891 8.7918L8.61493 7.84006L12.0006 0.5L15.3862 7.84006L23.4132 8.7918L17.4787 14.2799L19.054 22.2082L12.0006 18.26Z"></path></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#FFCC00" width="18" height="18"><path d="M12.0006 18.26L4.94715 22.2082L6.52248 14.2799L0.587891 8.7918L8.61493 7.84006L12.0006 0.5L15.3862 7.84006L23.4132 8.7918L17.4787 14.2799L19.054 22.2082L12.0006 18.26Z"></path></svg>
</span>
<span>Review it!</span>
<span><?php echo esc_html__('Review it!', 'altcha-spam-protection'); ?></span>
</a>
</div>
</div>
Expand All @@ -65,13 +65,32 @@ function altcha_options_page_html()
</form>

<div style="opacity: 0.8;">
<p>ALTCHA Spam Protection for WordPress, plugin version <?php echo esc_html(AltchaPlugin::$version) ?>, widget version <?php echo esc_html(AltchaPlugin::$widget_version) ?></p>
<p><?php
echo esc_html(sprintf(
__(
/* translators: %1$s is the plugin version, and %2$s is the widget version */
'ALTCHA Spam Protection for WordPress, plugin version %1$s, widget version %2$s',
'altcha-spam-protection',
),
AltchaPlugin::$version,
AltchaPlugin::$widget_version,
));
?></p>
<p>
Please give ALTCHA a <a href="https://wordpress.org/support/plugin/altcha-spam-protection/reviews/?filter=5#new-post" target="_blank">★★★★★ rating</a> on WordPress.org to help us get the word out.
<?php
echo esc_html(sprintf(
__(
/* translators: the placeholders are opening and closing tags for a link (<a> tag) */
'Please give ALTCHA a %s★★★★★ rating%s on WordPress.org to help us get the word out.',
'altcha-spam-protection',
),
'<a href="https://wordpress.org/support/plugin/altcha-spam-protection/reviews/?filter=5#new-post" target="_blank">',
'</a>',
)); ?>
</p>
<p>
<a href="https://github.com/altcha-org/altcha" target="_blank" style="display: inline-flex; gap: 0.3rem;">
<span>Star ALTCHA on GitHub!</span>
<span><?php echo esc_html__('Star ALTCHA on GitHub!', 'altcha-spam-protection'); ?></span>
</a>
</p>
</div>
Expand All @@ -82,23 +101,63 @@ function altcha_options_page_html()
function altcha_general_section_callback()
{
?>
<p>The <b>Self-hosted</b> mode does not require an API Key and runs fully within your WordPress installation, without any external services.</p>

<p>To access the ALTCHA's cloud API, you need an API Key. Visit <a href="https://altcha.org" target="_blank">altcha.org</a> for more information.</p>
<p><?php
echo sprintf(
esc_html__(
/* translators: the placeholders are opening and closing tags for bold */
'The %sSelf-hosted%s mode does not require an API Key and runs fully within your WordPress installation, without any external services.',
'altcha-spam-protection',
),
'<b>',
'</b>',
);
?></p>

<p><?php
echo sprintf(
esc_html__(
/* translators: the placeholder is a clickable link to altcha.org */
'To access the ALTCHA\'s cloud API, you need an API Key. Visit %s for more information.',
'altcha-spam-protection',
),
'<a href="https://altcha.org" target="_blank">altcha.org</a>',
);
?></p>

<div>
<a href="https://altcha.org/docs/api/api_keys/" target="_blank" class="button button-primary">Create an API Key &rarr;</a>
<a href="https://altcha.org/docs/api/api_keys/" target="_blank" class="button button-primary"><?php echo esc_html__('Create an API Key ', 'altcha-spam-protection'); ?></a>
</div>

<p>Your domain name for the API Key: <b><?php echo esc_html(AltchaPlugin::$hostname); ?></b></p>
<p><?php
echo sprintf(
esc_html__(
/* translators: the placeholder will be replaced with the domain name */
'Your domain name for the API Key: %s',
'altcha_spam_protection',
),
'<b>' . esc_html(AltchaPlugin::$hostname) . '</b>',
);
?></p>
<?php
}

function altcha_spam_filter_section_callback()
{
?>

<p>The <a href="https://altcha.org/docs/api/spam-filter-api" target="_blank">Spam Filter</a> is <b>available only in the API mode</b> with a valid API Key.</p>
<p><?php
echo sprintf(
esc_html__(
/* translators: the first two placeholders will be replaced with opening and closing tags for a link (<a> tag), the other two with opening and closing tags for bold (<b> tag). The two pairs may be swapped with each other, but the two tags within pairs may not. */
'The %1$sSpam Filter%2$s is %3$savailable only in the API mode%4$s with a valid API Key.',
'altcha-spam-protection',
),
'<a href="https://altcha.org/docs/api/spam-filter-api" target="_blank">',
'</a>',
'<b>',
'</b>',
);
?></p>

<?php
}
Expand All @@ -107,7 +166,7 @@ function altcha_widget_section_callback()
{
?>

<p>Customize the widget to fit your needs.</p>
<p><?php echo esc_html__('Customize the widget to fit your needs.', 'altcha-spam-protection'); ?></p>

<?php
}
Expand All @@ -116,7 +175,7 @@ function altcha_integrations_section_callback()
{
?>

<p>Activate ALTCHA for these integrations:</p>
<p><?php echo esc_html__('Activate ALTCHA for these integrations:', 'altcha-spam-protection'); ?></p>

<?php
}
Expand All @@ -125,7 +184,7 @@ function altcha_wordpress_section_callback()
{
?>

<p>Activate ALTCHA for the core Wordpress functionality:</p>
<p><?php echo esc_html__('Activate ALTCHA for the core Wordpress functionality:', 'altcha-spam-protection'); ?></p>

<?php
}
Expand Down
4 changes: 2 additions & 2 deletions includes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
function altcha_options_page()
{
add_options_page(
'ALTCHA Spam Protection',
'ALTCHA Anti-spam',
__('ALTCHA Spam Protection', 'altcha-spam-protection'),
__('ALTCHA Anti-spam', 'altcha-spam-protection'),
'manage_options',
'altcha_admin',
'altcha_options_page_html',
Expand Down
15 changes: 8 additions & 7 deletions includes/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,17 @@ public function get_translations($language = null)

$ALTCHA_WEBSITE = constant('ALTCHA_WEBSITE');
$translations = array(
"error" => __("Verification failed. Try again later.", "altcha-spam-protection"),
"error" => __('Verification failed. Try again later.', 'altcha-spam-protection'),
"footer" => sprintf(
__("Protected by %sALTCHA%s", "altcha-spam-protection"),
"<a href=\"$ALTCHA_WEBSITE\" target=\"_blank\">",
/* translators: the placeholders contain opening and closing tags for a link (<a> tag) */
__('Protected by %sALTCHA%s', 'altcha-spam-protection'),
'<a href="' . $ALTCHA_WEBSITE . '" target="_blank">',
"</a>",
),
"label" => __("I'm not a robot", "altcha-spam-protection"),
"verified" => __("Verified", "altcha-spam-protection"),
"verifying" => __("Verifying...", "altcha-spam-protection"),
"waitAlert" => __("Verifying... please wait.", "altcha-spam-protection"),
"label" => __('I\'m not a robot', 'altcha-spam-protection'),
"verified" => __('Verified', 'altcha-spam-protection'),
"verifying" => __('Verifying...', 'altcha-spam-protection'),
"waitAlert" => __('Verifying... please wait.', 'altcha-spam-protection'),
);

if ($originalLanguage !== null) {
Expand Down
Loading

0 comments on commit 573f727

Please sign in to comment.