From 8e0733a6c72da5d5637aa9a0b07bdf7ee4520c6b Mon Sep 17 00:00:00 2001 From: Lance Willett Date: Sat, 9 Nov 2013 23:28:09 +0000 Subject: [PATCH] Twenty Fourteen: allow slider "Previous" and "Next" labels to be translated, props michahwave. Fixes #25897. Built from https://develop.svn.wordpress.org/trunk@26071 git-svn-id: http://core.svn.wordpress.org/trunk@25991 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentyfourteen/functions.php | 9 +++++++-- wp-content/themes/twentyfourteen/js/slider.js | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/wp-content/themes/twentyfourteen/functions.php b/wp-content/themes/twentyfourteen/functions.php index 5d15351ead..8703cf655a 100644 --- a/wp-content/themes/twentyfourteen/functions.php +++ b/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/wp-content/themes/twentyfourteen/js/slider.js b/wp-content/themes/twentyfourteen/js/slider.js index 9d000dd275..8133223795 100644 --- a/wp-content/themes/twentyfourteen/js/slider.js +++ b/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.