From 8f85054cd03b2c23beeac75c4406c5a6133d6210 Mon Sep 17 00:00:00 2001 From: Lance Willett Date: Sat, 9 Nov 2013 23:27:28 +0000 Subject: [PATCH] Twenty Fourteen: allow slider "Previous" and "Next" labels to be translated, props michahwave. Fixes #25897. git-svn-id: https://develop.svn.wordpress.org/trunk@26071 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-content/themes/twentyfourteen/functions.php | 9 +++++++-- src/wp-content/themes/twentyfourteen/js/slider.js | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/wp-content/themes/twentyfourteen/functions.php b/src/wp-content/themes/twentyfourteen/functions.php index 5d15351ead..8703cf655a 100644 --- a/src/wp-content/themes/twentyfourteen/functions.php +++ b/src/wp-content/themes/twentyfourteen/functions.php @@ -235,8 +235,13 @@ function twentyfourteen_scripts() { if ( is_active_sidebar( 'sidebar-3' ) ) wp_enqueue_script( 'jquery-masonry' ); - if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) - wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131028', true ); + if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { + wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131109', true ); + wp_localize_script( 'twentyfourteen-slider', 'featuredSliderDefaults', array( + 'prevText' => __( 'Previous', 'twentyfourteen' ), + 'nextText' => __( 'Next', 'twentyfourteen' ) + ) ); + } wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20131102', true ); } diff --git a/src/wp-content/themes/twentyfourteen/js/slider.js b/src/wp-content/themes/twentyfourteen/js/slider.js index 9d000dd275..8133223795 100644 --- a/src/wp-content/themes/twentyfourteen/js/slider.js +++ b/src/wp-content/themes/twentyfourteen/js/slider.js @@ -546,9 +546,9 @@ animationSpeed: 600, // Integer: Set the speed of animations, in milliseconds. controlsContainer: '', // jQuery Object/Selector: container navigation to append elements. - // Text labels: @todo allow translation - prevText: 'Previous', // String: Set the text for the "previous" directionNav item. - nextText: 'Next' // String: Set the text for the "next" directionNav item. + // Text labels. + prevText: featuredSliderDefaults.prevText, // String: Set the text for the "previous" directionNav item. + nextText: featuredSliderDefaults.nextText // String: Set the text for the "next" directionNav item. }; // FeaturedSlider: plugin function.