From 5ccc4f640bb52f477b7ead90389e00223b213a30 Mon Sep 17 00:00:00 2001 From: Alexander Kirk Date: Sat, 12 Sep 2015 07:49:18 +0200 Subject: [PATCH] Use the WordPress.com slug for fetching the translation file Uses `GP_Locales::by_field( 'wp_locale', get_locale() )` to fetch the WordPress.com locale slug instead of using `get_locale()` to request the translation file. --- modules/notes.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/notes.php b/modules/notes.php index ef58bf4edac63..2c766bd849158 100644 --- a/modules/notes.php +++ b/modules/notes.php @@ -155,6 +155,21 @@ function admin_bar_menu() { if ( !is_object( $wp_admin_bar ) ) return; + $wpcom_locale = get_locale(); + + if ( !class_exists( 'GP_Locales' ) ) { + if ( defined( 'JETPACK__GLOTPRESS_LOCALES_PATH' ) && file_exists( JETPACK__GLOTPRESS_LOCALES_PATH ) ) { + require JETPACK__GLOTPRESS_LOCALES_PATH; + } + } + + if ( class_exists( 'GP_Locales' ) ) { + $wpcom_locale_object = GP_Locales::by_field( 'wp_locale', get_locale() ); + if ( $wpcom_locale_object instanceof GP_Locale ) { + $wpcom_locale = $wpcom_locale_object->slug; + } + } + $classes = 'wpnt-loading wpn-read'; $wp_admin_bar->add_menu( array( 'id' => 'notes', @@ -162,7 +177,7 @@ function admin_bar_menu() { ', 'meta' => array( - 'html' => '', + 'html' => '', 'class' => 'menupop', ), 'parent' => 'top-secondary',