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

WordCamp Geneva: Recent I18N Improvements in Wo...

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

WordCamp Geneva: Recent I18N Improvements in WordPress

Slides for my presentation at WordCamp Geneva, Switzerland, on November 18th, 2016.

Avatar for Pascal Birchler

Pascal Birchler

November 18, 2016
Tweet

More Decks by Pascal Birchler

Other Decks in Technology

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 ); }