diff --git wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-locale-banner.php wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-locale-banner.php
index d7c4c74d..a7c40e1f 100644
|
|
|
class Locale_Banner extends Base { |
| 75 | 75 | // Get the native language names of the locales. |
| 76 | 76 | $suggest_named_locales = []; |
| 77 | 77 | foreach ( $suggest_locales as $locale ) { |
| 78 | | $name = $this->get_native_language_name( $locale ); |
| | 78 | $locale = \GP_Locales::by_field( 'wp_locale', $locale )->native_name; |
| | 79 | $name = $locale->native_name; |
| 79 | 80 | if ( $name ) { |
| 80 | 81 | $suggest_named_locales[ $locale ] = $name; |
| 81 | 82 | } |
| … |
… |
class Locale_Banner extends Base { |
| 172 | 173 | } elseif ( ! $current_locale_is_suggested && ! $current_locale_is_translated && $is_plugin_request ) { |
| 173 | 174 | $suggest_string = sprintf( |
| 174 | 175 | $this->translate( 'This plugin is not available in %1$s yet. <a href="%2$s">Help translate it!</a>', $current_locale ), |
| 175 | | $this->get_native_language_name( $current_locale ), |
| | 176 | \GP_Locales::by_field( 'wp_locale', $current_locale )->native_name, |
| 176 | 177 | esc_url( 'https://translate.wordpress.org/projects/wp-plugins/' . $plugin_slug ) |
| 177 | 178 | ); |
| 178 | 179 | } |
| … |
… |
class Locale_Banner extends Base { |
| 339 | 340 | |
| 340 | 341 | return isset( $translations[ $gp_locale ] ) ? $translations[ $gp_locale ] : $string; |
| 341 | 342 | } |
| 342 | | |
| 343 | | protected function get_native_language_name( $locale ) { |
| 344 | | global $wpdb; |
| 345 | | |
| 346 | | $slug = str_replace( '_', '-', $locale ); |
| 347 | | $slug = strtolower( $slug ); |
| 348 | | |
| 349 | | $name = $wpdb->get_var( $wpdb->prepare( 'SELECT name FROM languages WHERE slug = %s', $slug ) ); |
| 350 | | if ( ! $name ) { |
| 351 | | $fallback_slug = explode( '-', $slug )[0]; // de-de => de |
| 352 | | $name = $wpdb->get_var( $wpdb->prepare( 'SELECT name FROM languages WHERE slug = %s', $fallback_slug ) ); |
| 353 | | if ( $name ) { |
| 354 | | return $name; |
| 355 | | } |
| 356 | | } else { |
| 357 | | return $name; |
| 358 | | } |
| 359 | | |
| 360 | | return ''; |
| 361 | | } |
| | 343 | |
| 362 | 344 | } |
| 363 | 345 | |
| 364 | 346 | // Strings for the POT file. |