Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return Jetpack locale string #2698

Merged
merged 1 commit into from
Sep 15, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion modules/notes.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,29 @@ 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',
'title' => '<span id="wpnt-notes-unread-count" class="' . esc_attr( $classes ) . '">
<span class="noticon noticon-notification"></span>
</span>',
'meta' => array(
'html' => '<div id="wpnt-notes-panel2" style="display:none" lang="'. esc_attr( get_locale() ) . '" dir="' . ( is_rtl() ? 'rtl' : 'ltr' ) . '"><div class="wpnt-notes-panel-header"><span class="wpnt-notes-header">' . __( 'Notifications', 'jetpack' ) . '</span><span class="wpnt-notes-panel-link"></span></div></div>',
'html' => '<div id="wpnt-notes-panel2" style="display:none" lang="'. esc_attr( $wpcom_locale ) . '" dir="' . ( is_rtl() ? 'rtl' : 'ltr' ) . '"><div class="wpnt-notes-panel-header"><span class="wpnt-notes-header">' . __( 'Notifications', 'jetpack' ) . '</span><span class="wpnt-notes-panel-link"></span></div></div>',
'class' => 'menupop',
),
'parent' => 'top-secondary',
Expand Down