How To Internationalize WordPress Themes

8m ago
7 Views
1 Downloads
6.11 MB
58 Pages
Last View : 23d ago
Last Download : 3m ago
Upload by : Wren Viola
Transcription

Big in Japan A guide to theme internationalization Shannon Smith WordCamp San Francisco 2013

Shannon Smith Web Developer Café Noir Design www.cafenoirdesign.com @cafenoirdesign

What We’ll Cover Introduction Get a multilingual CMS Internationalize Localize After the Theme Closing

Introduction

Why build multilingual themes? Photo: nevsred

Defining Multilingual Multilingual vs. Unilingual (but not English) Image: wpbeginner

Step 0: Get a Multilingual CMS Photo:Dave Q

Step 0 : WordPress in Your Language 1. Install WordPress 2. Install Language Files http://codex.wordpress.org/ WordPress in Your Language

Help! I can’t find my language! 1. Download the WordPress Translation Files http://svn.automattic.com/wordpress-i18n/ 2. Translate Core Files 3. Install Language Files http://codex.wordpress.org/WordPress in Your Language

Find Your Peeps! WordPress Polyglots http://make.wordpress.org/polyglots/ Photo: Joelk75

Find Your Project! L10n: Localization Teams http://codex.wordpress.org/ L10n:Localization Teams

Step 1: Internationalize Photo:andrechinn

i18n i18n internationalization { i 18 letters n

Internationalize “The first step is when the program's developers provide a mechanism and method for the eventual translation of the program and its interface to suit local preferences and languages for users worldwide.” http://codex.wordpress.org/Translating WordPress

GNU gettext Localization Framework Text Domain Message-Level Translation POT File Photo:liza31337 http://codex.wordpress.org/Translating WordPress http://www.gnu.org/software/gettext/gettext.html

Text Domains

Define Text Domain ?php load theme textdomain( domain, path ) ? http://codex.wordpress.org/Function Reference/load theme textdomain

Twenty-Twelve : Define Text Domain

Define Text Domain // Make theme available for translation // Translations can be filed in the /languages/ directory load theme textdomain( 'your-theme', TEMPLATEPATH . '/ languages' ); locale get locale(); locale file TEMPLATEPATH . "/languages/ locale.php"; if ( is readable( locale file) ) require once( locale file); http://codex.wordpress.org/Function Reference/load theme textdomain

Using the Text Domain ?php translated text ( 'text', 'domain' ); ? http://codex.wordpress.org/Function Reference/load theme textdomain

Message-Level Translation

Message-level Translation PHP return statement ('message') PHP echo statement e('message')

What is the difference? echo statement: PHP outputs whatever you tell it to the browser return statement: PHP returns a value from a function

Twenty-Twelve Echo Statement e('message')

Twenty-Twelve Return Statement ('message')

Simple Strings echo ' h2 ' . ( 'Blog Options' ) . ' /h2 '; echo ( 'Using this option you will make a fortune!' ); e( 'Using this option you will make a fortune!' ); http://codex.wordpress.org/I18n for WordPress Developers

Strings With Placeholders printf( ( 'Your zip code is %2 s, and your city is %1 s.' ), city, zipcode ); http://codex.wordpress.org/I18n for WordPress Developers

Strings With Plurals printf( n( 'We deleted %d spam message.', 'We deleted %d spam messages.', count ), count ); http://codex.wordpress.org/I18n for WordPress Developers

Disambiguation string x( 'Buffalo', 'an animal', 'plugin-domain' ); string x( 'Buffalo', 'a city in New York', 'plugindomain' ); string x( 'Buffalo', 'a verb meaning to confuse somebody', 'plugin-domain' ); /* translators: draft saved date format, see http:// php.net/date */ draft saved date format ( 'g:i:s a' ); http://codex.wordpress.org/I18n for WordPress Developers re-probably-doing-it-wrong/

Otto’s Unbreakable Laws of i18n Thou shalt not use PHP variables of any kind inside a translation function’s strings. Thou shalt always translate phrases and not words. Thou shalt disambiguate when needed. Thou shalt not put unnecessary HTML markup into the translated string. re-probably-doing-it-wrong/

Automate Adding Text Domains php add-textdomain.php -i domain phpfile phpfile . http://codex.wordpress.org/I18n for WordPress Developers

POT File

What Is a POT File? Photo:dbrekke

GNU gettext Files POT (Portable Object Template) files PO (Portable Object) files MO (Machine Object) files http://codex.wordpress.org/Translating WordPress

POT (Portable Object Template) files only file required for i18n includes every message passed into a () or e() function http://codex.wordpress.org/Translating WordPress

POT (Portable Object Template) files

How do I get a POT file? Photo:zzpza

Option A: Poedit

Option B: WordPress-i18n Tools SVN the WordPress-i18n tools and run the makepot.php script php makepot.php wp-theme your-themedirectory Deprecated in favour of GlotPress http://codex.wordpress.org/User:Skippy/Creating POT Files

Option C: GlotPress Download and install locally

Isn’t there a plugin for that?

Option D: Codestyling Localization Plugin

Option E: ICanLocalize Service

Step 2: Localize Photo:slightly everything

L10n L10n Localization { L 10 letters n

Localize “The second step is the actual localization, the process by which the text on the page and other settings are translated and adapted to another language and culture, using the framework prescribed by the developers of the software.” http://codex.wordpress.org/Translating WordPress

Localize

Localize

Language & Locale en US – US English en UK – UK English

GNU gettext Files POT (Portable Object Template) files PO (Portable Object) files MO (Machine Object) files http://codex.wordpress.org/Translating WordPress

Create an MO File

What a MO File Looks Like

Define Your WordPress Locale

Step 3: Profit! Photo:Hub

Step 3: Multilingual Website Photo:Hub

Everything After the Theme Plugins Widgets Language Switcher Translated Content Plugin (WPML) or WordPress Multisite

Closing

Shannon Smith Web Developer Café Noir Design Get The Slides: http://chroni.ca www.cafenoirdesign.com @cafenoirdesign

1. Download the WordPress Translation Files http://svn.automattic.com/wordpress-i18n/ 2.Translate Core Files 3. Install Language Files age

Related Documents:

WordPress Themes WordPress Premium Themes WordPress Free Themes WordPress Plugins ite Templates WordPress Hosting WordPress.com CreativeMarket.com . with crowdfunding b Astoundif plugin and fundif theme. Plugin will empower o

1.1.3 WordPress.com dan WordPress.org WordPress menyediakan dua alamat yang berbeda, yaitu WordPress.com dan WordPress.org. WordPress.com merupakan situs layanan blog yang menggunakan mesin WordPress, didirikan oleh perusahaan Automattic. Dengan mendaftar pada situs WordPress.com, pengguna tidak perlu melakukan instalasi atau

Your Signature Themes report presents your five most dominant themes of talent, in the rank order revealed by your responses to StrengthsFinder. Of the 34 themes measured, these are your "top five." Your Signature Themes are very important

THEMES AND MOTIFS The central subject or topic in a work of literature (or art) is referred to as its theme. A sophisticated work will usually explore several, interrelated themes. A motif is a recurring idea or contrast examined in a work of literature and these will usually relate to the themes being explored. There are several major themes and

work/products (Beading, Candles, Carving, Food Products, Soap, Weaving, etc.) ⃝I understand that if my work contains Indigenous visual representation that it is a reflection of the Indigenous culture of my native region. ⃝To the best of my knowledge, my work/products fall within Craft Council standards and expectations with respect to

Translate Plugins/Themes » Find a Theme/Plugin that is translation ready You can find translation-ready Themes by filtering your search on wordpress.org. Navigate to wordpress.org Select Themes Select the link for “check out our new filter and tag interface” On the Tag Filter screen select the checkbox next

Infrequent Foreign Marketing Regular Foreign Marketing International Marketing Global Marketing 1-12 Factors Favoring Faster Internationalization Companies with either high technology and/or marketing-based resources are better equipped to internationalize than more traditional manufacturing companies (Tseng et. al., 2007)

API –1.0.0 System Reads (user accounts, labor codes, and other configruations) Customer Read Equipment Read Equipment Hour Meter Write Product Read Inventory Read Work Order Read / Write Time Read / Write File Read / Write Web hooks for: Work Order status changes Work Order confirmations (tech, customer .