Skip to content

Fix internationalization issues. #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions includes/class.clef-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public function add_invite_bulk_action_to_dropdown() {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('<option>').val('invite_to_clef').text('Invite to use Clef')
$('<option>').val('invite_to_clef').text('<?php _e('Invite to use Clef', 'wpclef'); ?>')
.appendTo("select[name='action'], select[name='action2']");
});
</script>
Expand Down Expand Up @@ -437,7 +437,15 @@ public function handle_invite_bulk_action_admin_notices() {
add_settings_error(
CLEF_OPTIONS_NAME,
"clef_invite_success",
sprintf(__("%d %s successfully invited to Clef.", "wpclef"), $num_invited, _n("user", "users", $num_invited)),
sprintf(
/* translators: %s: user with number. */
__("%s successfully invited to Clef.", 'wpclef'),
/* translators: %d: number of user. */
sprintf(
esc_html( _n( '%d user', '%d users', $num_invited, 'wpclef' ) ),
$num_invited
)
),
"updated"
);
}
Expand All @@ -452,7 +460,7 @@ public function add_dashboard_widget() {

wp_add_dashboard_widget(
$name,
'Your site is Clef enabled!',
__('Your site is Clef enabled!', 'wpclef'),
array($this, 'render_dashboard_widget')
);

Expand Down Expand Up @@ -481,9 +489,12 @@ public function add_dashboard_widget() {

public function render_dashboard_widget() {
?>
<p><?php _e("Clef is the best way to log in to WordPress <b>without usernames or passwords</b>. You're a few clicks away from joining more than 600,000 other WordPress sites that use Clef to make logging in safer and easier."); ?></p>
<p><?php _e("Click below to finish setting up Clef or learn more <a href='https://getclef.com/wordpress' target='_blank'>here</a>.") ?></p>
<a href="<?php echo admin_url('admin.php?page=clef') ?>" class="button button-primary"><?php _e("Finish setup"); ?></a>
<p><?php _e("Clef is the best way to log in to WordPress <b>without usernames or passwords</b>. You're a few clicks away from joining more than 600,000 other WordPress sites that use Clef to make logging in safer and easier.", 'wpclef'); ?></p>
<p><?php printf( /* translators: %s: here */
__("Click below to finish setting up Clef or learn more %s.", 'wpclef'),
'<a href="https://getclef.com/wordpress" target="_blank">'.__('here', 'wpclef').'</a>'
); ?></p>
<a href="<?php echo admin_url('admin.php?page=clef') ?>" class="button button-primary"><?php _e("Finish setup", 'wpclef'); ?></a>
<?php
}

Expand Down Expand Up @@ -519,7 +530,18 @@ public function ajax_invite_users() {
try {
ClefInvite::invite_users($filtered_users, $is_network_admin);
$num_invited = count($filtered_users);
return array("success" => true, "message" => sprintf(__("%d %s successfully invited to Clef.", "wpclef"), $num_invited, _n("user", "users", $num_invited)));
return array(
"success" => true,
"message" => sprintf(
/* translators: %s: user with number. */
__("%s successfully invited to Clef.", 'wpclef'),
/* translators: %d: number of user. */
sprintf(
esc_html( _n( '%d user', '%d users', $num_invited, 'wpclef' ) ),
$num_invited
)
)
);
} catch (Exception $e) {
return new WP_Error('clef_email_error', $e->getMessage());
}
Expand Down
5 changes: 2 additions & 3 deletions includes/class.clef-invite.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ public static function invite_users($users, $is_network_admin) {
if (count($errors) == count($filtered_users)) {
$message = __("there was an error sending the invite email to all users. Copy and paste the preview email to your users and they'll be walked through a tutorial to connect with Clef", 'wpclef');
} else {
$message = __("unable to send emails to the following users: ", 'wpclef');
$message .= join(", ", $errors);
$message .= __(". Copy and paste the preview email to your users and they'll be walked through a tutorial to connect with Clef", 'wpclef');
$message = sprintf( __("unable to send emails to the following users: %s.", 'wpclef'), join(", ", $errors) );
$message .= __("Copy and paste the preview email to your users and they'll be walked through a tutorial to connect with Clef", 'wpclef');
}
throw new Exception($message);
} else {
Expand Down
17 changes: 11 additions & 6 deletions templates/admin/form.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div class="settings-section">
<div class="password-settings">
<div class="inputs-container">
<h3><?php _e("Disable passwords", "wpclef"); ?> <a class="setting-info" href="http://support.getclef.com/article/60-recommended-password-settings-for-clef-wordpress-plugin" target="clef">Learn more about these settings</a></h3>
<h3><?php _e("Disable passwords", 'wpclef'); ?> <a class="setting-info" href="http://support.getclef.com/article/60-recommended-password-settings-for-clef-wordpress-plugin" target="clef"><?php _e("Learn more about these settings", 'wpclef'); ?></a></h3>
<div class="input-container">
<label for="disable_passwords"><?php _e("Disable passwords for Clef users", "wpclef"); ?></label>
<?php $form->getSection('clef_password_settings')->getField('disable_passwords')->render(); ?>
Expand All @@ -28,7 +28,7 @@
</div>
<?php if (property_exists($form->getSection('clef_password_settings'), 'custom_roles')) { ?>
<div class="input-container custom-roles">
<label class="title"><?php _e("Disable passwords for custom roles"); ?></label>
<label class="title"><?php _e("Disable passwords for custom roles", 'wpclef'); ?></label>
<?php foreach($form->getSection('clef_password_settings')->custom_roles as $role => $role_obj) { ?>
<div class="custom-role">
<label for=""><?php echo $role_obj['name'] ?></label>
Expand Down Expand Up @@ -56,8 +56,8 @@
</div>
<div class="override-settings settings-section">
<div class="inputs-container">
<h3><?php _e("Override URL", "wpclef"); ?> <a class="setting-info" href="http://support.getclef.com/article/11-creating-a-secret-url-where-you-can-log-into-your-wordpress-site-with-a-password" target="clef">Learn more about this setting</a></h3>
<p><?php _e("You have disabled passwords for some (or all) users. In case of emergency, you can create a special link where passwords can still be used. This is a good safety precaution.", "wpclef"); ?></p>
<h3><?php _e("Override URL", 'wpclef'); ?> <a class="setting-info" href="http://support.getclef.com/article/11-creating-a-secret-url-where-you-can-log-into-your-wordpress-site-with-a-password" target="clef"><?php esc_html_e('Learn more about this setting', 'wpclef') ?></a></h3>
<div class="input-container">
<label for=""><?php echo wp_login_url() ?>?override=</label>
<?php $form->getSection('clef_override_settings')->getField('key')->render(array("placeholder" => __( "Enter override key here", 'wpclef' ))); ?>
Expand Down Expand Up @@ -111,7 +111,12 @@
<div id="registration-settings" class="settings-section">
<div class="inputs-container">
<h3><?php _e("Register with your phone", "wpclef"); ?></h3>
<p><?php _e("Register new users with the Clef mobile app. The <strong>Membership: anyone can register</strong> setting also must be enabled in WordPress's <a href='".admin_url('options-general.php')."'><strong>General Settings</strong></a>.", "wpclef"); ?></p>
<p><?php
printf( /* translators: %s: link to General Setting */
__("Register new users with the Clef mobile app. The <strong>Membership: anyone can register</strong> setting also must be enabled in WordPress's %s.", 'wpclef'),
'<a href="'.admin_url('options-general.php').'"><strong>'.__('General Settings').'</strong></a>'
);
?></p>
<div class="input-container">
<label for=""><?php _e("Allow visitors to your site to register with Clef", "wpclef"); ?></label>
<?php $form->getSection('clef_settings')->getField('register')->render(); ?>
Expand Down Expand Up @@ -144,8 +149,8 @@
</div>
</div>
<div class="clef-settings clef-settings__buttons">
<?php submit_button("Save settings", "primary clef-settings__saveButton"); ?>
<?php submit_button("Reset Application ID and Secret", "delete clef-settings__resetButton"); ?>
<?php submit_button(__("Save settings", 'wpclef'), "primary clef-settings__saveButton"); ?>
<?php submit_button(__("Reset Application ID and Secret", 'wpclef'), "delete clef-settings__resetButton"); ?>
</div>
</form>

Expand Down
4 changes: 2 additions & 2 deletions templates/js-templates/invite.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="clear"></div>
<div class="inputs-container">
<div class="invite-users__individually-container">
<h3>Invite users individually or in bulk</h3>
<h3><?php _e("Invite users individually or in bulk", 'wpclef') ?></h3>
<div>
<img src="<?php echo CLEF_URL ?>assets/dist/img/invite.png" alt="invite individual users" class="invite-users__img">
<div class="invite-users__individually">
Expand All @@ -16,7 +16,7 @@
</div>


<h3>Invite users by role</h3>
<h3><?php _e("Invite users by role", 'wpclef'); ?></h3>
<p><?php _e("We've made it really easy to get all of your site's users up and running with Clef. Click the button below and we'll send an email inviting your users to set up their Clef account on your site. The invite email has <b>step-by-step instructions</b> and a video walkthrough.", "wpclef"); ?></p>

<div class="input-container">
Expand Down
4 changes: 2 additions & 2 deletions templates/override_link_email.tpl.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p><?php _e('Hi there,', 'wpclef'); ?></p>
<p><?php printf(__("Passwords have now been disabled on %s for all users who enable <a href='https://getclef.com'>Clef</a>. If you ever have an issue that causes you to be locked out of your site, we've created an override URL which will allow you to log in to your site without Clef. The link is: ", "wpclef"), $site_url) ?></p>
<p><a href="<?php echo $override_link ?>"><?php echo $override_link ?></a></p>
<p><?php _e("You can learn more about this functionality <a href='http://support.getclef.com/article/11-creating-a-secret-url-where-you-can-log-into-your-wordpress-site-with-a-password'>here</a>. If you have any issues, please visit <a href='http://support.getclef.com'>support.getclef.com</a>."); ?></p>
<p><?php _e('Thanks!', 'wpclef'); ?></p>
<p><?php _e("You can learn more about this functionality <a href='http://support.getclef.com/article/11-creating-a-secret-url-where-you-can-log-into-your-wordpress-site-with-a-password'>here</a>. If you have any issues, please visit <a href='http://support.getclef.com'>support.getclef.com</a>.", 'wpclef'); ?></p>
<p><?php esc_html_e('Thanks!', 'wpclef'); ?></p>
6 changes: 3 additions & 3 deletions templates/pro/form.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<h3><?php _e("Customize the Clef login screen", "wpclef"); ?> <a class="setting-info" href="http://support.getclef.com/article/8-customizing-the-clef-login-page-in-wordpress" target="clef">Learn more about this setting</a></h3>
<p><?php _e("Add a custom logo and message to the Clef overlay to make your visitors feel at home."); ?></p>
<div class="input-container">
<label for=""><?php _e("Custom logo", "wpclef"); ?></label>
<div class="button" id="clef-custom-logo-clear">Remove</div>
<div class="button button-primary" id="clef-custom-logo-upload">Upload a file</div>
<label for=""><?php esc_html_e("Custom logo", 'wpclef'); ?></label>
<div class="button" id="clef-custom-logo-clear"><?php esc_html_e('Remove', 'wpclef'); ?></div>
<div class="button button-primary" id="clef-custom-logo-upload"><?php esc_html_e('Upload a file', 'wpclef'); ?></div>
<?php $form->getSection('customization')->getField('logo')->render(); ?>
</div>
<div class="input-container">
Expand Down