From f5dde473d7c098d9239f9f890bf768b7f081eae3 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 26 Nov 2013 01:53:17 +0000 Subject: [PATCH] Allow Open Sans to be disabled per language. props dimadin. fixes #26063. git-svn-id: https://develop.svn.wordpress.org/trunk@26376 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/script-loader.php | 38 +++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 311bdda495..620763c6a5 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -559,22 +559,36 @@ function wp_default_styles( &$styles ) { $styles->add( 'ie', "/wp-admin/css/ie$suffix.css" ); $styles->add_data( 'ie', 'conditional', 'lte IE 7' ); - $subsets = 'latin,latin-ext'; + $open_sans_font_url = ''; - /* translators: To add an additional Open Sans character subset specific to your language, - * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language. + /* translators: If there are characters in your language that are not supported + * by Open Sans, translate this to 'off'. Do not translate into your own language. */ - $subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)' ); + if ( 'off' !== _x( 'on', 'Open Sans font: on or off' ) ) { + $subsets = 'latin,latin-ext'; - if ( 'cyrillic' == $subset ) - $subsets .= ',cyrillic,cyrillic-ext'; - elseif ( 'greek' == $subset ) - $subsets .= ',greek,greek-ext'; - elseif ( 'vietnamese' == $subset ) - $subsets .= ',vietnamese'; + /* translators: To add an additional Open Sans character subset specific to your language, + * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language. + */ + $subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)' ); - // Hotlink Open Sans, for now - $styles->add( 'open-sans', "//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets" ); + if ( 'cyrillic' == $subset ) { + $subsets .= ',cyrillic,cyrillic-ext'; + } elseif ( 'greek' == $subset ) { + $subsets .= ',greek,greek-ext'; + } elseif ( 'vietnamese' == $subset ) { + $subsets .= ',vietnamese'; + } + + $query_args = array( + 'family' => 'Open+Sans:300italic,400italic,600italic,300,400,600', + 'subset' => $subsets, + ); + // Hotlink Open Sans, for now + $open_sans_font_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' ); + } + + $styles->add( 'open-sans', $open_sans_font_url ); // Dashicons $styles->add( 'dashicons', '/wp-includes/css/dashicons.css' );