Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GWTD: I18N Improvements in WordPress 4.6 And Beyond

GWTD: I18N Improvements in WordPress 4.6 And Beyond

Slides for my presentation at the 2nd Global WordPress Translation Day on November 12th, 2016.

Pascal Birchler

November 12, 2016
Tweet

More Decks by Pascal Birchler

Other Decks in Programming

Transcript

  1. $switched = switch_to_locale( get_user_locale() ) // Do stuff. if (

    $switched ) { restore_previous_locale(); }
  2. // PHP: wp_localize_script( 'myplugin-script', '_myPluginL10n', array( 'helloWorld' => __( 'Hello

    World','myplugin' ) ) ); // JS: alert( _myPluginL10n.helloWorld );
  3. if ( 1 == number ) { use( _myPluginL10n.singularString );

    } else { use( _myPluginL10n.pluralString ); }