diff --git a/assets/src/blocks/login-button/edit.js b/assets/src/blocks/login-button/edit.js index 91c8d5b5..88e35a04 100644 --- a/assets/src/blocks/login-button/edit.js +++ b/assets/src/blocks/login-button/edit.js @@ -3,7 +3,7 @@ * * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/ */ -import { __ } from '@wordpress/i18n'; +import { __, _x } from '@wordpress/i18n'; /** * Editor styles for the block. @@ -45,7 +45,7 @@ export default function Edit( { attributes, setAttributes, className } ) { setAttributes( { buttonText: value } ); }, value: buttonText, - placeholder: __( 'Login with Google', 'login-with-google' ), + placeholder: _x( 'Login with Google', 'Login button text displayed in block.', 'login-with-google' ), }; const forceDisplayAttributes = { diff --git a/languages/login-with-google.pot b/languages/login-with-google.pot index e62b36be..513bef29 100644 --- a/languages/login-with-google.pot +++ b/languages/login-with-google.pot @@ -9,17 +9,15 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2025-08-19T16:58:53+00:00\n" +"POT-Creation-Date: 2025-11-19T12:34:48+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"X-Generator: WP-CLI 2.10.0\n" +"X-Generator: WP-CLI 2.12.0\n" "X-Domain: login-with-google\n" #. Plugin Name of the plugin #: login-with-google.php -#: src/Modules/Settings.php:324 -#: templates/google-login-button.php:14 -#: assets/build/blocks/login-button/index.js:1 -#: assets/src/blocks/login-button/edit.js:48 +#: assets/build/blocks/login-button/index.js:86 +#: assets/build/blocks/login-button/index.js:48 msgid "Login with Google" msgstr "" @@ -48,9 +46,15 @@ msgstr "" #. translators: %$s is replaced with requested service name. #: src/Container.php:66 +#, php-format msgid "Invalid Service %s Passed to the container" msgstr "" +#: src/Modules/Block.php:144 +msgctxt "Login button text displayed in block." +msgid "Login with Google" +msgstr "" + #: src/Modules/Login.php:166 msgid "Could not authenticate the user, please try again." msgstr "" @@ -101,6 +105,7 @@ msgstr "" #. translators: %1s will be replaced by page link #: src/Modules/Settings.php:224 +#, php-format msgid "If this setting is checked, a new user will be created even if membership setting is off." msgstr "" @@ -124,13 +129,19 @@ msgstr "" msgid "Login with Google settings" msgstr "" +#: src/Modules/Settings.php:324 +msgctxt "Menu title" +msgid "Login with Google" +msgstr "" + #: src/Modules/Shortcode.php:101 -msgid "Login with google" +msgctxt "Login button text displayed in shortcode." +msgid "Login with Google" msgstr "" #: src/Plugin.php:160 -#: assets/build/blocks/login-button/index.js:1 -#: assets/src/blocks/login-button/edit.js:67 +#: assets/build/blocks/login-button/index.js:103 +#: assets/build/blocks/login-button/index.js:67 msgid "Settings" msgstr "" @@ -144,6 +155,7 @@ msgstr "" #. translators: %s is replaced with email ID of user trying to register #: src/Utils/Authenticator.php:124 +#, php-format msgid "Cannot register with this email: %s" msgstr "" @@ -185,33 +197,35 @@ msgstr "" msgid "User data is stale! Please try again." msgstr "" +#: templates/google-login-button.php:14 +msgctxt "Default login button text." +msgid "Login with Google" +msgstr "" + #: templates/google-login-button.php:24 msgid "Log out" msgstr "" -#: assets/build/blocks/login-button/index.js:1 -#: assets/src/blocks/login-button/edit.js:52 +#: assets/build/blocks/login-button/index.js:89 +#: assets/build/blocks/login-button/index.js:52 msgid "Display Logout" msgstr "" -#: assets/build/blocks/login-button/index.js:1 -#: assets/src/blocks/login-button/edit.js:53 +#: assets/build/blocks/login-button/index.js:90 +#: assets/build/blocks/login-button/index.js:53 msgid "If the user is logged in, keeping this box unchecked will remove the Login with Google button from the page. If the box is checked, the button will show with title changed to ‘Logout’" msgstr "" #: assets/build/js/onetap.js:22 -#: assets/src/js/onetap.js:22 msgid "Invalid URL for Redirection" msgstr "" #: assets/build/blocks/login-button/block.json -#: assets/src/blocks/login-button/block.json msgctxt "block title" msgid "Log in with Google" msgstr "" #: assets/build/blocks/login-button/block.json -#: assets/src/blocks/login-button/block.json msgctxt "block description" msgid "Login with Google button block." msgstr "" diff --git a/src/Modules/Block.php b/src/Modules/Block.php index 617ef9e5..0f21bed5 100644 --- a/src/Modules/Block.php +++ b/src/Modules/Block.php @@ -141,7 +141,7 @@ public function render_login_button( array $attributes ): string { $markup = $this->markup( [ 'login_url' => $this->client->authorization_url(), - 'custom_btn_text' => $attributes['buttonText'] ?? false, + 'custom_btn_text' => ! empty( $attributes['buttonText'] ) ? $attributes['buttonText'] : _x( 'Login with Google', 'Login button text displayed in block.', 'login-with-google' ), 'force_display_block' => $attributes['forceDisplay'] ?? false, ] ); diff --git a/src/Modules/Settings.php b/src/Modules/Settings.php index 71215273..53af3e05 100644 --- a/src/Modules/Settings.php +++ b/src/Modules/Settings.php @@ -321,7 +321,7 @@ public function whitelisted_domains(): void { public function settings_page(): void { add_options_page( __( 'Login with Google settings', 'login-with-google' ), - __( 'Login with Google', 'login-with-google' ), + _x( 'Login with Google', 'Menu title', 'login-with-google' ), 'manage_options', 'login-with-google', [ $this, 'output' ] diff --git a/src/Modules/Shortcode.php b/src/Modules/Shortcode.php index 02931959..00c6d050 100644 --- a/src/Modules/Shortcode.php +++ b/src/Modules/Shortcode.php @@ -98,7 +98,7 @@ public function callback( $attrs = [] ): string { $redirect_to = Helper::get_redirect_url(); $attrs = shortcode_atts( [ - 'button_text' => __( 'Login with google', 'login-with-google' ), + 'button_text' => _x( 'Login with Google', 'Login button text displayed in shortcode.', 'login-with-google' ), 'force_display' => 'no', 'redirect_to' => $redirect_to, ], diff --git a/templates/google-login-button.php b/templates/google-login-button.php index c7817fca..965d21f1 100644 --- a/templates/google-login-button.php +++ b/templates/google-login-button.php @@ -11,7 +11,7 @@ if ( isset( $custom_btn_text ) && $custom_btn_text ) { $button_text = esc_html( $custom_btn_text ); } else { - $button_text = ( ! empty( $button_text ) ) ? $button_text : __( 'Login with Google', 'login-with-google' ); + $button_text = ( ! empty( $button_text ) ) ? $button_text : _x( 'Login with Google', 'Default login button text.', 'login-with-google' ); } if ( empty( $login_url ) ) {