Make WordPress Core


Ignore:
Timestamp:
09/26/2012 08:05:12 PM (12 years ago)
Author:
lancewillett
Message:

Twenty Twelve: allow translators to load extra character subsets for Open Sans font, props obenland. See #21751.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentytwelve/functions.php

    r22002 r22020  
    116116       enter 'disable-open-sans'. Otherwise enter 'enable-open-sans'. Do not translate into your own language. */
    117117    if ( false === strpos( _x( 'enable-open-sans', 'Open Sans font: enable or disable', 'twentytwelve' ), 'disable' ) ) {
     118        $subsets = 'latin,latin-ext';
     119        /* translators: To add an additional Open Sans character subset specific to your language enter 'greek', 'cyrillic' or 'vietnamese'.
     120           Otherwise enter 'open-sans-subset'. Do not translate into your own language. */
     121        $add_subset = _x( 'open-sans-subset', 'Additional Open Sans font subset: greek, cyrillic or vietnamese', 'twentytwelve' );
     122
     123        if ( in_array( $add_subset, array( 'greek', 'cyrillic', 'vietnamese' ) ) ) {
     124            $character_sets = array(
     125                'greek'      => 'greek,greek-ext',
     126                'cyrillic'   => 'cyrillic,cyrillic-ext',
     127                'vietnamese' => 'vietnamese'
     128            );
     129            $subsets = implode( ',', array( $subsets, $character_sets[ $add_subset ] ) );
     130        }
     131
    118132        $protocol = is_ssl() ? 'https' : 'http';
    119         wp_enqueue_style( 'twentytwelve-fonts', "$protocol://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700", array(), null );
     133        $query_args = array(
     134            'family' => 'Open+Sans:400italic,700italic,400,700',
     135            'subset' => $subsets
     136        );
     137        wp_enqueue_style( 'twentytwelve-fonts', add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ), array(), null );
    120138    }
    121139
Note: See TracChangeset for help on using the changeset viewer.