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

Recent I18N Improvements in WordPress Core

Recent I18N Improvements in WordPress Core

Caching, timezones and internationalisation are just a few things that make developers cringe. In this lightning talk at WordCamp London 2017 I highlight some recent enhancement in the field of I18N in WordPress to show how we’ve got you covered. I also gave a glimpse at what may come in the future.

5253258c79d25b02f51e0ac55e30cf69?s=128

Pascal Birchler

March 19, 2017
Tweet

More Decks by Pascal Birchler

Other Decks in Technology

Transcript

  1. Recent I18N Improvements in WordPress Core

  2. Language Packs

  3. None
  4. WordPress 4.6

  5. None
  6. load_plugin_textdomain( 'myplugin', false, 'languages' )

  7. Good bye, load_plugin_textdomain()

  8. Just-in-time Loading for Translations

  9. WordPress 4.7

  10. User Admin Language

  11. None
  12. Back End: Français Front End: English

  13. Locale Switching

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

    $switched ) { restore_previous_locale(); }
  15. None
  16. Beyond

  17. Preferred Languages

  18. None
  19. JavaScript Internationalisation

  20. // PHP: wp_localize_script( 'myplugin-script', '_myPluginL10n', array( 'helloWorld' => __( 'Hello

    World','myplugin' ) ) ); // JS: alert( _myPluginL10n.helloWorld );
  21. wp.i18n.__( 'Hello World' )

  22. User Timezones

  23. None
  24. Thanks!