Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
THEME &
PLUGIN
LOCALISATION
@ThemeBoy
¿POR QUÉ?
56%OF WEBSITES ARE IN ENGLISH
56%OF WEBSITES ARE IN ENGLISH
27%OF INTERNET USERS SPEAK ENGLISH
JE M'EN
FOUS
CAN’T READ
=
WON’T BUY
LANGUAGES
ARE ALL
DIFFERENT
WORD LENGTH
WORD LENGTH
BUTTERFLYENGLISH:
WORD LENGTH
BUTTERFLY
蝶
ENGLISH:
CHINESE:
WORD LENGTH
BUTTERFLY
蝶
SCHMETTERLING
ENGLISH:
CHINESE:
GERMAN:
WORD LENGTH
SOLUTION: CSS
GENDER
GENDER
ADD NEW EVENT:
ДОДАДИ НОВ НАСТАН
!
!
!
GENDER
ADD NEW EVENT:
ДОДАДИ НОВ НАСТАН
ADD NEW TEAM:
ДОДАДИ НОВА ЕКИПА
!
GENDER
ADD NEW EVENT:
ДОДАДИ НОВ НАСТАН
ADD NEW TEAM:
ДОДАДИ НОВА ЕКИПА
ADD NEW PERFORMANCE:
ДОДАИ НОВИ ПЕРФОРМАНСИИ
GENDER
MORE EFFICIENT:
printf( __( ‘Add New %s’ ), __( ‘Team’ ) );
MORE ACCURATE:
_e( ‘Add New Team’ );
RTL
RTL
DIRECTION OF
TEXT
RTL
DIRECTION OF
INFORMATION
RTL
SOLUTION: RTL STYLESHEET
RTLif ( is_rtl() ) {
wp_enqueue_style(
‘rtl-stylesheet’,
get_template_directory_uri() . ‘/rtl.css’
);
}
TRANSIFEX& POEDIT
SET IT UP
<?php load_theme_textdomain( $domain, $path ) ?>
<?php load_plugin_textdomain( $domain, $abs_rel_path, $plugin_r...
GETTEXT FUNCTIONS
// Return translation
__( ‘Hello’, ‘my-text-domain’ );
// Echo translation
_e( ‘Hello’, ‘my-text-domain’...
CREATE A POT FILE
POEDIT SOURCE KEYWORDS
__
_e
_n:1,2
_x:1,2
_ex:1,2
_nx:4c,1,2
esc_attr__
esc_attr_e
esc_attr_x:1,2c
esc_...
USE CORE
LOCALES
ALL TRANSLATIONS OF WP CORE:https://github.com/ThemeBoy/wp-languages
USE CORE
STRINGS
ALL TRANSLATIONS OF WP CORE:https://github.com/ThemeBoy/wp-languages
# python get-pip.py
TRANSIFEX CLIENT
https://bootstrap.pypa.io/get-pip.py
GET PIP
# pip install transifex-client
INSTALL T...
TRANSIFEX CLIENT
INITIALISE & CONFIGURE
$ cd my-plugin
$ tx init
$ nano .tx/config
[main]
host = https://www.transifex.com...
$ tx push -s
TRANSIFEX CLIENT
PUSH SOURCE STRINGS
$ tx pull -l ja
PULL TRANSLATIONS FROM A LANGUAGE
$ tx pull
PULL ALL TRA...
GNU GETTEXT
DOWNLOAD & INSTALL
$ for file in $(find ./languages/ -name *.po -type f);
do msgfmt "$file" -o “${file%po}mo”;...
RECAP
BECAUSE
STATISTICS
BECAUSE
YOU CARE
BECAUSE
MONEY
THINK ABOUT
WORD LENGT
THINK ABOUT
GENDER
THINK ABOUT
RTL
USE
POEDIT
USE
TRANSIFEX
USE
WP CORE
QUESTIONS
@ThemeBoy
Theme & Plugin Localisation
Theme & Plugin Localisation
Theme & Plugin Localisation
Upcoming SlideShare
Loading in …5
×

Theme & Plugin Localisation

1,151 views

Published on

Brian Miyaji discusses the advantages of localizing code for WordPress, things to consider when developing software for a global audience, and how to save time for developers and translators.

Images:
"tokyo" by Osamu Kaneko, used under CC BY 2.0 https://www.flickr.com/photos/osamukaneko/9237609761/
"Confused" by Mika Hiltunen, used under CC BY 2.0 https://www.flickr.com/photos/saaste/13150099564/
“Union Jack Teapot" by The Hamster Factor, used under CC BY 2.0 / Desaturated from original https://www.flickr.com/photos/disaster_area/8424925130/
"Paris" by Moyan Brenn, used under CC BY 2.0 / Desaturated from original https://www.flickr.com/photos/aigle_dore/5238554034/
"Chinese Calligraphy" by Jiwei Han, used under CC BY 2.0 https://www.flickr.com/photos/p_h/2199524538
"Oak and Ash" by Let Ideas Compete, used under CC BY 2.0 https://www.flickr.com/photos/question_everything/4107359250/
"Butterfly" by Auntie P, used under CC BY 2.0 / Desaturated from original https://www.flickr.com/photos/auntiep/1170669/
"Boy and Girl Hummel Figurines" by Jason Pratt, used under CC BY 2.0 / Desaturated from original https://www.flickr.com/photos/jasonpratt/2347428960/
"Arabic Writing" by Pietro Izzo, used under CC BY 2.0 / Desaturated from original https://www.flickr.com/photos/pietroizzo/4527056064/
"WordPress Moleskine notebook" by Nikolay Bachiyski, used under CC BY 2.0 / Desaturated from original https://www.flickr.com/photos/nbachiyski/2186228674/

Published in: Software
  • Be the first to comment

  • Be the first to like this

Theme & Plugin Localisation

  1. 1. THEME & PLUGIN LOCALISATION @ThemeBoy
  2. 2. ¿POR QUÉ?
  3. 3. 56%OF WEBSITES ARE IN ENGLISH
  4. 4. 56%OF WEBSITES ARE IN ENGLISH 27%OF INTERNET USERS SPEAK ENGLISH
  5. 5. JE M'EN FOUS
  6. 6. CAN’T READ = WON’T BUY
  7. 7. LANGUAGES ARE ALL DIFFERENT
  8. 8. WORD LENGTH
  9. 9. WORD LENGTH BUTTERFLYENGLISH:
  10. 10. WORD LENGTH BUTTERFLY 蝶 ENGLISH: CHINESE:
  11. 11. WORD LENGTH BUTTERFLY 蝶 SCHMETTERLING ENGLISH: CHINESE: GERMAN:
  12. 12. WORD LENGTH SOLUTION: CSS
  13. 13. GENDER
  14. 14. GENDER ADD NEW EVENT: ДОДАДИ НОВ НАСТАН ! ! !
  15. 15. GENDER ADD NEW EVENT: ДОДАДИ НОВ НАСТАН ADD NEW TEAM: ДОДАДИ НОВА ЕКИПА !
  16. 16. GENDER ADD NEW EVENT: ДОДАДИ НОВ НАСТАН ADD NEW TEAM: ДОДАДИ НОВА ЕКИПА ADD NEW PERFORMANCE: ДОДАИ НОВИ ПЕРФОРМАНСИИ
  17. 17. GENDER MORE EFFICIENT: printf( __( ‘Add New %s’ ), __( ‘Team’ ) ); MORE ACCURATE: _e( ‘Add New Team’ );
  18. 18. RTL
  19. 19. RTL DIRECTION OF TEXT
  20. 20. RTL DIRECTION OF INFORMATION
  21. 21. RTL SOLUTION: RTL STYLESHEET
  22. 22. RTLif ( is_rtl() ) { wp_enqueue_style( ‘rtl-stylesheet’, get_template_directory_uri() . ‘/rtl.css’ ); }
  23. 23. TRANSIFEX& POEDIT
  24. 24. SET IT UP <?php load_theme_textdomain( $domain, $path ) ?> <?php load_plugin_textdomain( $domain, $abs_rel_path, $plugin_rel_path ) ?> LOAD TRANSLATED STRINGS define ('WPLANG', ‘pt_BR’); // To this CHANGE WORDPRESS LANGUAGE define ('WPLANG', ‘’); // Change this
  25. 25. GETTEXT FUNCTIONS // Return translation __( ‘Hello’, ‘my-text-domain’ ); // Echo translation _e( ‘Hello’, ‘my-text-domain’ ); // Placeholders printf( __( ‘Add New %s.’, 'my-text-domain' ), $label ); // Plurals printf( _n( ‘One post’, ‘%s posts’, $count, ‘my-text-domain’ ), $count ); // Disambiguation by context _x( ‘Post’, ‘noun’, ‘my-text-domain’ ); _x( ‘Post’, ‘verb’, ‘my-text-domain’ );
  26. 26. CREATE A POT FILE POEDIT SOURCE KEYWORDS __ _e _n:1,2 _x:1,2 _ex:1,2 _nx:4c,1,2 esc_attr__ esc_attr_e esc_attr_x:1,2c esc_html__ esc_html_e esc_html_x:1,2c _n_noop:1,2 _nx_noop:3c,1,2 __ngettext_noop:1,2
  27. 27. USE CORE LOCALES ALL TRANSLATIONS OF WP CORE:https://github.com/ThemeBoy/wp-languages
  28. 28. USE CORE STRINGS ALL TRANSLATIONS OF WP CORE:https://github.com/ThemeBoy/wp-languages
  29. 29. # python get-pip.py TRANSIFEX CLIENT https://bootstrap.pypa.io/get-pip.py GET PIP # pip install transifex-client INSTALL THE TRANSIFEX CLIENT
  30. 30. TRANSIFEX CLIENT INITIALISE & CONFIGURE $ cd my-plugin $ tx init $ nano .tx/config [main] host = https://www.transifex.com ! [project_slug.resource_slug] file_filter = languages/my-plugin—<lang>.po source_file = languages/my-plugin.pot source_lang = en_US
  31. 31. $ tx push -s TRANSIFEX CLIENT PUSH SOURCE STRINGS $ tx pull -l ja PULL TRANSLATIONS FROM A LANGUAGE $ tx pull PULL ALL TRANSLATIONS
  32. 32. GNU GETTEXT DOWNLOAD & INSTALL $ for file in $(find ./languages/ -name *.po -type f); do msgfmt "$file" -o “${file%po}mo”; done http://www.gnu.org/software/gettext/ https://gist.github.com/mbillard/1647940 COMPILE ALL .PO FILES TO .MO
  33. 33. RECAP
  34. 34. BECAUSE STATISTICS
  35. 35. BECAUSE YOU CARE
  36. 36. BECAUSE MONEY
  37. 37. THINK ABOUT WORD LENGT
  38. 38. THINK ABOUT GENDER
  39. 39. THINK ABOUT RTL
  40. 40. USE POEDIT
  41. 41. USE TRANSIFEX
  42. 42. USE WP CORE
  43. 43. QUESTIONS @ThemeBoy

×