From f7256d801d4d2177e0923881325065f467f7c402 Mon Sep 17 00:00:00 2001 From: Mayuko Moriyama Date: Sun, 12 Feb 2017 23:20:26 +0900 Subject: [PATCH 1/4] Add i18n strings. --- includes/class.clef-admin.php | 4 ++-- templates/admin/form.tpl.php | 8 ++++---- templates/js-templates/invite.tpl.php | 4 ++-- templates/pro/form.tpl.php | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/includes/class.clef-admin.php b/includes/class.clef-admin.php index cacb143..0bc500d 100644 --- a/includes/class.clef-admin.php +++ b/includes/class.clef-admin.php @@ -394,7 +394,7 @@ public function add_invite_bulk_action_to_dropdown() { ?> @@ -452,7 +452,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') ); diff --git a/templates/admin/form.tpl.php b/templates/admin/form.tpl.php index 517942b..13d37a5 100644 --- a/templates/admin/form.tpl.php +++ b/templates/admin/form.tpl.php @@ -17,7 +17,7 @@
-

Learn more about these settings

+

getSection('clef_password_settings')->getField('disable_passwords')->render(); ?> @@ -56,8 +56,8 @@
-

Learn more about this setting

+

getSection('clef_override_settings')->getField('key')->render(array("placeholder" => __( "Enter override key here", 'wpclef' ))); ?> @@ -144,8 +144,8 @@
- - + +
diff --git a/templates/js-templates/invite.tpl.php b/templates/js-templates/invite.tpl.php index bf7c86b..e0a7344 100644 --- a/templates/js-templates/invite.tpl.php +++ b/templates/js-templates/invite.tpl.php @@ -4,7 +4,7 @@
-

Invite users individually or in bulk

+

invite individual users
@@ -16,7 +16,7 @@
-

Invite users by role

+

step-by-step instructions and a video walkthrough.", "wpclef"); ?>

diff --git a/templates/pro/form.tpl.php b/templates/pro/form.tpl.php index 341289a..fff14d4 100644 --- a/templates/pro/form.tpl.php +++ b/templates/pro/form.tpl.php @@ -4,9 +4,9 @@

Learn more about this setting

- -
Remove
-
Upload a file
+ +
+
getSection('customization')->getField('logo')->render(); ?>
From a2f4a221af8866e8761283a9f3841e4c80796acc Mon Sep 17 00:00:00 2001 From: Mayuko Moriyama Date: Sun, 12 Feb 2017 16:29:08 +0900 Subject: [PATCH 2/4] Don't break sentence. --- includes/class.clef-invite.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/includes/class.clef-invite.php b/includes/class.clef-invite.php index ac68673..d0bd7b3 100644 --- a/includes/class.clef-invite.php +++ b/includes/class.clef-invite.php @@ -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 { From 0017481db8c3520a39148c34263adf53dc61d0e2 Mon Sep 17 00:00:00 2001 From: Mayuko Moriyama Date: Sun, 12 Feb 2017 23:32:26 +0900 Subject: [PATCH 3/4] Use placeholder / add comment for translator. --- includes/class.clef-admin.php | 30 ++++++++++++++++++++++++++---- templates/admin/form.tpl.php | 7 ++++++- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/includes/class.clef-admin.php b/includes/class.clef-admin.php index 0bc500d..93c8949 100644 --- a/includes/class.clef-admin.php +++ b/includes/class.clef-admin.php @@ -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" ); } @@ -482,8 +490,11 @@ public function add_dashboard_widget() { public function render_dashboard_widget() { ?>

without usernames or passwords. 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."); ?>

-

here.") ?>

- +

'.__('here', 'wpclef').'' + ); ?>

+ 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()); } diff --git a/templates/admin/form.tpl.php b/templates/admin/form.tpl.php index 13d37a5..fde5290 100644 --- a/templates/admin/form.tpl.php +++ b/templates/admin/form.tpl.php @@ -111,7 +111,12 @@

-

Membership: anyone can register setting also must be enabled in WordPress's General Settings.", "wpclef"); ?>

+

Membership: anyone can register setting also must be enabled in WordPress's %s.", 'wpclef'), + ''.__('General Settings').'' + ); + ?>

getSection('clef_settings')->getField('register')->render(); ?> From 92168ec88a02d40fa6cf7b62132fce03d99946f7 Mon Sep 17 00:00:00 2001 From: Mayuko Moriyama Date: Sun, 12 Feb 2017 23:40:49 +0900 Subject: [PATCH 4/4] Missing text domain. --- includes/class.clef-admin.php | 2 +- templates/admin/form.tpl.php | 2 +- templates/override_link_email.tpl.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/class.clef-admin.php b/includes/class.clef-admin.php index 93c8949..25717b1 100644 --- a/includes/class.clef-admin.php +++ b/includes/class.clef-admin.php @@ -489,7 +489,7 @@ public function add_dashboard_widget() { public function render_dashboard_widget() { ?> -

without usernames or passwords. 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."); ?>

+

without usernames or passwords. 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'); ?>

'.__('here', 'wpclef').'' diff --git a/templates/admin/form.tpl.php b/templates/admin/form.tpl.php index fde5290..ce642cf 100644 --- a/templates/admin/form.tpl.php +++ b/templates/admin/form.tpl.php @@ -28,7 +28,7 @@

getSection('clef_password_settings'), 'custom_roles')) { ?>
- + getSection('clef_password_settings')->custom_roles as $role => $role_obj) { ?>
diff --git a/templates/override_link_email.tpl.php b/templates/override_link_email.tpl.php index 78474b6..48c2c82 100644 --- a/templates/override_link_email.tpl.php +++ b/templates/override_link_email.tpl.php @@ -1,5 +1,5 @@

Clef. 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) ?>

-

here. If you have any issues, please visit support.getclef.com."); ?>

-

+

here. If you have any issues, please visit support.getclef.com.", 'wpclef'); ?>

+