Skip to content

Commit 9f459df

Browse files
committed
Make the alternate suggestion string more human-friendly
1 parent 301ed93 commit 9f459df

File tree

2 files changed

+20
-23
lines changed

2 files changed

+20
-23
lines changed

mu-plugins/rest-api/endpoints/class-wporg-plugins-locale-banner-controller.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,21 @@ public function get_response_for_item( $request ) {
122122
if ( 'en_US' !== $current_locale && $current_gp_locale && ! in_array( $current_locale, $translated_locales ) ) {
123123
$output_locale = $current_locale;
124124
switch_to_locale( $output_locale );
125-
$suggest_string = sprintf(
126-
// translators: %s: Locale name.
127-
__( 'This plugin is not translated into %s yet.', 'wporg' ),
128-
$current_gp_locale->native_name
129-
);
130125

131-
// Append some other suggestions if they exist.
132126
if ( ! empty( $suggestion_links ) ) {
133-
$suggest_string .= ' ' . sprintf(
134-
// translators: %s: List of links to plugin in other locales.
135-
__( 'This plugin is available in %s.', 'wporg' ),
127+
$suggest_string = sprintf(
128+
// translators: %1$s: Locale name, %2$s: List of links to plugin in other locales.
129+
__( 'This plugin is not translated into %1$s yet, but it is available in %2$s.', 'wporg' ),
130+
$current_gp_locale->native_name,
136131
wp_sprintf_l( '%l', $suggestion_links )
137132
);
133+
} else {
134+
$suggest_string = sprintf(
135+
// translators: %s: Locale name.
136+
__( 'This plugin is not translated into %s yet.', 'wporg' ),
137+
$current_gp_locale->native_name
138+
);
138139
}
139-
140-
// Lastly, add the call for help.
141140
$suggest_string .= ' ' . sprintf(
142141
'<a href="%1$s">%2$s</a>',
143142
esc_url( 'https://translate.wordpress.org/projects/wp-plugins/' . $plugin_slug ),

mu-plugins/rest-api/endpoints/class-wporg-themes-locale-banner-controller.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,20 @@ public function get_response_for_item( $request ) {
122122
if ( 'en_US' !== $current_locale && $current_gp_locale && ! in_array( $current_locale, $translated_locales ) ) {
123123
$output_locale = $current_locale;
124124
switch_to_locale( $output_locale );
125-
$suggest_string = sprintf(
126-
// translators: %s: Locale name.
127-
__( 'This theme is not translated into %s yet.', 'wporg' ),
128-
$current_gp_locale->native_name
129-
);
130-
131-
// Append some other suggestions if they exist.
132125
if ( ! empty( $suggestion_links ) ) {
133-
$suggest_string .= ' ' . sprintf(
134-
// translators: %s: List of links to theme in other locales.
135-
__( 'This theme is available in %s.', 'wporg' ),
126+
$suggest_string = sprintf(
127+
// translators: %1$s: Locale name, %2$s: List of links to theme in other locales.
128+
__( 'This theme is not translated into %1$s yet, but it is available in %2$s.', 'wporg' ),
129+
$current_gp_locale->native_name,
136130
wp_sprintf_l( '%l', $suggestion_links )
137131
);
132+
} else {
133+
$suggest_string = sprintf(
134+
// translators: %s: Locale name.
135+
__( 'This theme is not translated into %s yet.', 'wporg' ),
136+
$current_gp_locale->native_name
137+
);
138138
}
139-
140-
// Lastly, add the call for help.
141139
$suggest_string .= ' ' . sprintf(
142140
'<a href="%1$s">%2$s</a>',
143141
esc_url( 'https://translate.wordpress.org/projects/wp-themes/' . $theme_slug ),

0 commit comments

Comments
 (0)