Getting WordPress to speak your langauge

  • 2,867 views
Uploaded on

Presentation slides from WordCamp Montreal 2012 talk. …

Presentation slides from WordCamp Montreal 2012 talk.

An in-depth look at creating WordPress sites in a language other than English, and/or with multiple languages. We will: set up a WordPress site that is not English, see what is needed in themes and plugins to use them in other languages, and learn how to create translations for themes and plugins. We will then review the different strategies and options for creating multilingual sites, from simple sites with custom themes, to multilingual plugins and multisite installs, and the issues related to each approach.

More in: Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,867
On Slideshare
0
From Embeds
0
Number of Embeds
4

Actions

Shares
Downloads
0
Comments
0
Likes
4

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • I’m Rick RadkoI design & develop software, websites, web applications -> at my company R-Cubed Design Forge -> I started building websites and web apps in 1996.something that is different about me, ->I was originally a hardware design engineer -> But now you will find me mostly with my head buried in computer code -> I’m also equally comfortable doing graphic design workI’ve been using WordPress for over 4 years now: - it’s been my main website platform for the last 2 years - I’m also a co-organizer of The Ottawa WordPress GroupSlides are posted on slideshare -> link will be at the end too

Transcript

  • 1. hello bonjour guten tag Hola 你好 helló hej“Getting WordPress to hallo γειά σου speak your language” ciao sveiki halló cześć alo 안녕하세요 привіт hallåRick Radko WordCamp Montrealr3df.com August 18th, 2012
  • 2. A little bit about meRick Radko – R-Cubed Design Forge  Software, web and app designer/developer.  Creating web sites since 1996.  Artistic and creative engineer.  WordPress enthusiast.  Co-organizer of: The Ottawa WordPress Group. http://wpottawa.orgSlides are posted at:  http://www.slideshare.net/r3df© 2012 Rick Radko, r3df.com 1
  • 3. About this talkThe objective of this talk is to provide a primer for theconcepts and resources needed to create WordPresssites in any language(s).To keep the talk non-technical for the user track (and toshorten it) I‟ve referenced links for the technical aspects,or moved them to the appendix rather than discussingthem in the talk.If you have technical questions after this talk you cancontact me at: wpinfo@r3df.com.© 2012 Rick Radko, r3df.com 2
  • 4. Fair warning!If you want to set-up a WordPress site in differentlanguages yourself, you will need:  to do WordPress installs.And depending on the configuration or complexityof your site, you may need to:  edit some configuration files.  edit/create language files.  edit/create theme files*All of this is well documented on the codex and elsewhere (useGoogle), and quite simple for basic sites.© 2012 Rick Radko, r3df.com 3
  • 5. WordPress.com noteIf you are a http://wordpress.com user:  You can easily set your blog to any one of over 50 languages with simple options see: http://en.support.wordpress.com/language-settings/  Except for the next section on translations, most of this talk does not apply to wordpress.com.If you want to do more with languages than youcan on wordpress.com, then stick around…© 2012 Rick Radko, r3df.com 4
  • 6. Lets get started!Translation:  The act of converting one language to another.  Tends to be the thing that concerns people the most when they consider a web site in another language.  You will need to get phrases, strings, and words translated, but:  That is relatively straight forward.  You don‟t even need to be able speak the language to create a site in that language, although it makes it easier.© 2012 Rick Radko, r3df.com 5
  • 7. Getting translations  Human translations a) Do it yourself (if you speak the languages) b) Hire a translator:  Good/best results.  Aware of regional differences, customs and dialects.  9-14 cents per word.  Machine translations:  Inconsistent results – some good, some bad.  Better than it was a few years ago.  Still not a good option for a business site.© 2012 Rick Radko, r3df.com 6
  • 8. Google TranslateYou can translate entire sites by entering a URL inGoogle Translate http://translate.google.ca.© 2012 Rick Radko, r3df.com 7
  • 9. French to English: the good This looks promising.© 2012 Rick Radko, r3df.com 8
  • 10. French to English: the bad But if we start looking more carefully…© 2012 Rick Radko, r3df.com 9
  • 11. French to English: the ugly A bit further down the page  The ideal speaker discuss a topic on WordPress really is passionate and for which he may present …© 2012 Rick Radko, r3df.com 10
  • 12. How about English to French?More translation issues…© 2012 Rick Radko, r3df.com 11
  • 13. Translation summaryFor professional results, use human translators: “Under the weather” won‟t become: “Beneath a turbulent sky”© 2012 Rick Radko, r3df.com 12
  • 14. Creating a website in another languageTo create a web site in another language:  It is obvious to most people that we need to translate our content, posts, pages, menu items, captions, and other content, and even possibly comments, to the languages wanted on the website.  What is not so obvious is that we need to translate WordPress.© 2012 Rick Radko, r3df.com 13
  • 15. Translating WordPressThe rest of this talk will be about translating orlocalizing WordPress.  In the first half we‟ll look at:  Concepts, terms and issues with localization.  Creating a single language site.  In the second half we will look at:  Creating multilingual sites.© 2012 Rick Radko, r3df.com 14
  • 16. Internationalization: The first step in localizationInternationalization  Is the process of designing software applications so that they can be adapted to various languages and regions without programming changes.  WordPress uses the GNU gettext libraries and tools for internationalization.  Programmers use gettext to produce a file with a list of words and strings that need translation.For more info see:http://codex.wordpress.org/I18n_for_WordPress_Developers© 2012 Rick Radko, r3df.com 15
  • 17. LocalizationLocalization  Is the process where translators adapt internationalized software to another language and culture by adding locale specific components and translating the text.  Localization does not require any changes to the application code. (programmers are not needed)For more info see:http://codex.wordpress.org/Translating_WordPress© 2012 Rick Radko, r3df.com 16
  • 18. LocaleA locale is a combination of language and regionaldialect.  Locales usually correspond to countries.  They are represented by codes.  Examples of locale codes:  fr-_CA would be for French and Canada.  en_ CA would be for English and Canada.For more info see:http://www.gnu.org/software/gettext/manual/html_chapter/gettext_16.html#Language-Codeshttp://www.gnu.org/software/gettext/manual/html_chapter/gettext_16.html#Country-Codes© 2012 Rick Radko, r3df.com 17
  • 19. Locale and WordPressWordPress, the themes, plugins and widgetsneed to know what language to use to displaythe site.  That is determined by the locale set in the wp-config.php file.  It‟s a bit of PHP code and looks like: define (WPLANG, „fr_FR);  If it‟s not set, or the matching language files don‟t exist, English will be used.© 2012 Rick Radko, r3df.com 18
  • 20. Some key items affected by localizationDate formats:  Is it 05/29/2012 or 29/05/2012?  May 29th, 2012 <-> Le 29 mai 2012Time display:  Is it 4:30pm or 16:30?Number formats:  Is it 1.987,06 or 1,987.06?© 2012 Rick Radko, r3df.com 19
  • 21. More: why localize WordPress?Separators, curly quotes, apostrophes anddashes:  All can have regional differences.Localizing sets the HTML language code for thesite:  Tells the browser, search engines and other readers the language that your content is written in.© 2012 Rick Radko, r3df.com 20
  • 22. 73 localizations ready and waitingFortunately most of us won‟t need to do the workof localizing WordPress:  Currently there are 73 translations of WordPress available.So how do you get these other languages?© 2012 Rick Radko, r3df.com 21
  • 23. Start with “WordPress in your language”Start with thecodex page:  WordPress in Your Language  This page documents the current translations for WordPress. http://codex.wordpress.org/WordPress_in_Your_Language© 2012 Rick Radko, r3df.com 22
  • 24. Find the language you wantThis is the French entry:Note: fr_FR is the locale for French from France.  There is no Canadian version.© 2012 Rick Radko, r3df.com 23
  • 25. Official site for the French WordPressOffers some general information and a downloadfor the French version of WordPress. http://fr.wordpress.org/© 2012 Rick Radko, r3df.com 24
  • 26. WordPress Francophone (the 4th link)Has more French WordPress support, includingforums (the 5th link). http://www.wordpress-fr.net/© 2012 Rick Radko, r3df.com 25
  • 27. Installable versions vs language filesThe majority of the languages listed on WordPressin Your Language have complete installableversions of WordPress.There are many however that have only thelanguage files needed to convert the defaultversion of WordPress to a new language.© 2012 Rick Radko, r3df.com 26
  • 28. Installable localizationsThe installable versions of WordPress are:  Easy to install.  Use the same “5 minute” install as the default WordPress.  Great for single language sites.  Could use as starting point for multilingual sites.  Often include translated sample content. (Hello world post, sample page, menus etc.)© 2012 Rick Radko, r3df.com 27
  • 29. Language file only localizationsLanguage file only localizations:  Do not have sample content.  Are a bit more technical to install.*See: “Creating your own translations” in the appendix for moreinformation on language files.© 2012 Rick Radko, r3df.com 28
  • 30. Installing the French versionGet the install file from http://fr.wordpress.org/.It‟s a full install file, so install as you would for aregular manual install of WordPress:  See: http://codex.wordpress.org/Installing_WordPress  Cannot use installers like SimpleScripts or Fantastico, on most North American hosting companies they will have the English version.© 2012 Rick Radko, r3df.com 29
  • 31. A fresh French WordPress installThe front page withthe usual “HelloWorld” post.The Twenty Eleventheme is thedefault.© 2012 Rick Radko, r3df.com 30
  • 32. French WordPress install – example pageThe example page.Everything on the sitelooks pretty muchlike the regularWordPress installexcept it‟s all French.© 2012 Rick Radko, r3df.com 31
  • 33. Le Tableau de bord© 2012 Rick Radko, r3df.com 32
  • 34. Wait, the dashboard is in French too?I want a French site, but I don‟t want a Frenchdashboard because:  I don‟t know French that well.  Some of the contributors are not fluent in French.  My web person doesn‟t know French.Fortunately, there‟s a plugin for that!© 2012 Rick Radko, r3df.com 33
  • 35. Dashboard language pluginsDashboard language plugins:  Allow you to select a language for the dashboard separate from the site.  Some have per user settings.  Some have options for the front-end tool bar.  Some have language selectors for the login screen.*Dashboard language plugins fool WordPress by overriding thelocale for the dashboard.**The language files need to be installed for each language youwant to use in the dashboard.© 2012 Rick Radko, r3df.com 34
  • 36. Dashboard language plugin examplesSome dashboard language plugins: (there aremore)  WP Native Dashboard http://wordpress.org/extend/plugins/wp-native- dashboard/  Backend Localization http://wordpress.org/extend/plugins/kau-boys- backend-localization/© 2012 Rick Radko, r3df.com 35
  • 37. What about adding plugins and themes?An added plugin or theme shows some Englishtext:  On the front-end.  It needs to be localized.  In the dashboard.  Does it matter?© 2012 Rick Radko, r3df.com 36
  • 38. Plugins & themes for other languagesTo use plugins or themes with WordPress inanother language:  They need to be internationalized.  If they are not, look elsewhere, it typically requires a lot of code change to internationalize any sizable plugin or theme. (You also then have a maintenance nightmare)  Localization is great, but not required.  That means that there is no language file for the language you need.  If it is internationalized, you can localize it, sometimes more easily than you would think.© 2012 Rick Radko, r3df.com 37
  • 39. Checking for internationalizationCheck the plugin or theme description for:  Any mention of language support.  Any mention of translations, or translation credits.  Any mention of localizable.  Lists of languages.If you find any of these, then it is at leastinternationalized.  You still may need to create a localization for your language though.© 2012 Rick Radko, r3df.com 38
  • 40. Themes have some tags to help tooSome themes on the wordpress.org repositoryhave been tagged with:  translation-ready  rtl-language-supportIf a theme is tagged, then it is internationalized.© 2012 Rick Radko, r3df.com 39
  • 41. Internationalization not obvious?There are more things you can do/look for tocheck for internationalization, but you need toopen up and look at the plugin/theme files.See “Internationalization, digging deeper” in the appendix.© 2012 Rick Radko, r3df.com 40
  • 42. Creating your own translationsIf there is no language file in your language for:  WordPress or  a theme or  a pluginyou can create your own.If you use a lot of plugins it is likely you will needto localize some.  Once you have the tools, it‟s not very hard.See: “Creating your own translations” in the appendix..© 2012 Rick Radko, r3df.com 41
  • 43. Plugin example: Tweet Blender in French© 2012 Rick Radko, r3df.com 42
  • 44. Tweet Blender in FrenchThe Tweet Blender translation was created by:  Making a copy of the default translation file (.pot). (renamed of course)  Entering translations for 21 of 206 strings in the file. (All that show on the front-end of the site.)  Mostly times and duration, hour(s), day(s).  18 of the translations were 1 word each.The dashboard options are still in English.*NOTE: you can‟t change the actual tweet text.**”Original language” note is from another plugin I developed.© 2012 Rick Radko, r3df.com 43
  • 45. Creating a Canadian French localizationAs we have already noted:  There is no official Canadian French version.  There are differences from France French.  For example email„ or e-mail used in France, is courriel‟ in Quebec.To create a Canadian French version, start withthe France French files and modify as needed.© 2012 Rick Radko, r3df.com 44
  • 46. Installing WordPress language files manuallySometimes you will need to install language filesmanually:  If you want a multilingual site.  To convert an existing install to a new language.  Your language does not have a complete install file available.  You have created your own language files.*Formore on installing language see “Installing WordPresslanguage files” in the appendix.© 2012 Rick Radko, r3df.com 45
  • 47. Tricks for installing language filesTrick #1  Change the WPLANG parameter in the wp-config.php file to the locale you want.  remember until you load the file, the site will default to English.  Go to the Updates page in the dashboard and hit the “Re-load Now” button for the language.  This trick may not work if you have a Dashboard Language Plugin active.  Only works for languages on the wordpress.org repository.© 2012 Rick Radko, r3df.com 46
  • 48. Load German with trick #1  This trick does not load WordPress theme files.  Sample content is not changed. (Hello World)© 2012 Rick Radko, r3df.com 47
  • 49. More tricks for language filesTrick #2  Use WP Native Dashboard:  It‟s an option in the settings.  It only loads .mo files.  To get the .po files if you need them, switch the dashboard to that language, do an update as in trick #1.  This trick also: does not get theme files or the sample content, and only works for .org files.*The file types .po and .mo are defined in “Creating your owntranslations” in the appendix.© 2012 Rick Radko, r3df.com 48
  • 50. One more trick for language filesPlugin: Codestyling Localizationhttp://wordpress.org/extend/plugins/codestyling-localization/With this plugin: “You can manage and edit all gettext translation files (*.po/*.mo) directly out of the WordPress Admin Center without any need of an external editor.”© 2012 Rick Radko, r3df.com 49
  • 51. Multilingual web sitesA multilingual web site is a web site that has morethan one language on the same site, or relatedgroup of sites.A bilingual web site is a 2 language multilingualweb site.  The WordCamp Montreal site is bilingual or multilingual.© 2012 Rick Radko, r3df.com 50
  • 52. An obvious multilingual exampleWordCamp Montreal… http://fr.2012.montreal.wordcamp.org/ http://2012.montreal.wordcamp.org/© 2012 Rick Radko, r3df.com 51
  • 53. Unilingual web site definitionA unilingual web site is a web site that has onlylanguage shown on it.  The WordPress France site is a French only web site and is unilingual French, not multilingual.© 2012 Rick Radko, r3df.com 52
  • 54. WordPress is not multilingual “WordPress does not support a bilingual or multilingual blog out-of-the-box.” http://codex.wordpress.org/Multilingual_WordPress© 2012 Rick Radko, r3df.com 53
  • 55. WordPress is unilingualWhen you install a localized version of WordPress:  The site language is that language only.  You do get English as a default due to the way WordPress is constructed.  Even if you install more than one language, the site will still be unilingual in the locale set in the wp-config.php file.  We need to do more to get a multilingual site.© 2012 Rick Radko, r3df.com 54
  • 56. Multilingual WordPress approachesThe rest of the talk will be about setting upmultilingual sites with WordPress.To make a multilingual site you need:  All the skills we just learned for creating a unilingual site.  To add a few tricks to make it multilingual.© 2012 Rick Radko, r3df.com 55
  • 57. Multilingual general notes  No matter which approach you use, you will still have to deal with plugins and themes on a case by case basis.  Some plugins that are internationalized do not work well in some multilingual set-ups.  No approach will get you around entering content multiple times: once for each language.  Right now there is no one best approach, each has it benefits and issues.© 2012 Rick Radko, r3df.com 56
  • 58. Translation structureTranslation structure may dictate the approachtaken.Multilingual site content can be:  Symmetric or mirrored.  All content is in all languages  Each item is linked to the other languages.  Governments, and institutions.© 2012 Rick Radko, r3df.com 57
  • 59. Translation structure continued  Partially symmetric.  Most content in all languages.  Blogs – may be left in original language.  Reduces translation costs  Comments – may be left in submitted language.  Typically not practical to translate them.  Costs would be high.  Hard to be timely.  Un-connected.  Sites have a link to other languages, but not on an content item by item basis.© 2012 Rick Radko, r3df.com 58
  • 60. Multilingual with multiple sitesConceptually, the simplest implementation ofmultilingual is:  2 or more completely independent installs of WordPress, one for each language.© 2012 Rick Radko, r3df.com 59
  • 61. Issues with multiple sitesMultiple individual installs is not recommendedas:  The maintenance is high, need to update each site individually. (repeat everything for each site)  Hard to link matching pages between languages.  One plugin: Bilingual Linker (only for bilingual sites)  No dashboard connection:  Content management is more difficult.  Multiple logins.© 2012 Rick Radko, r3df.com 60
  • 62. Reasonable WordPress multilingual set-ups.3 main approaches  Single site  Using custom theme/tricks  Using multilingual plugins  Multisite© 2012 Rick Radko, r3df.com 61
  • 63. Single site multilingualA single site multilingual install needs to manageall the different language versions of:  the content  the menus  the output from themes, widgets and pluginsand co-ordinate them so that they provide thesame language for every requested page.© 2012 Rick Radko, r3df.com 62
  • 64. Single site using custom theme/tricksSingle site installs can made multilingual throughthe use of clever custom themes that use:  page templates or  custom metadata or  post categories  other tricksto define the language of the page and set thematching menus, theme text items andcorresponding sidebars.© 2012 Rick Radko, r3df.com 63
  • 65. Single site with tricks issuesThere may be issues with plugin/widget output:  Locales may not be set properly for each language with this technique.This technique:  Requires extensive theme coding.  Some content may be hard-coded in the theme.  Requires that content contributors mark content with tags, meta data or templates.  Does not support symmetric linking well.  Works best for small sites with static content.© 2012 Rick Radko, r3df.com 64
  • 66. Single site with pluginsThere are a quite a few plugins that managemultilingual WordPress single site installs.  qTranslate  WPML (not on the repository, it‟s not free)  Built-in translation system  A lot of assistive tools for translating themes and plugins.  xili-language  + some more© 2012 Rick Radko, r3df.com 65
  • 67. Single site with plugins issuesPlugin issues:  Lock-in is the #1 issue  Once you start using one of these plugins it is hard to change to something else.  Can be an issue at update time, plugin updates can lag WordPress, and plugins sometimes die.  qTranslate is barely being maintained right now and has had some bug issues over the last year with some WordPress updates.  Most sites built with these plugins will not run, or will only display 1 default language if the plugin is disabled or removed.© 2012 Rick Radko, r3df.com 66
  • 68. Single site with plugins issues  Can be complex to manage the install.  Hacks and workarounds are often needed for themes and plugins/widgets to use them with the multilingual plugins.  Complex plugins with their own data storage, like events managers, calendars may not work.  Widget management is an issue.  There is no built-in way of displaying different widgets on “different language” sites (as far as WordPress is concerned it‟s one site). Need a widget manager like: http://wordpress.org/extend/plugins/widget-logic/© 2012 Rick Radko, r3df.com 67
  • 69. Single site with plugins issues  Having differences in the theme, or different themes for each language is a challenge.  It is still really one site.  URL‟s are not always translated  Extra plugin is needed for qTranslate  Bugs & stability (not future proof)© 2012 Rick Radko, r3df.com 68
  • 70. Single site with plugins benefitsWith a single site with plugins:  Only one WordPress install to manage/update  Only one theme to manage.  It‟s easy to manage content.  Single dashboard and login.  Easy to link content between languages  Some plugins manage adding language files.  Some plugins help with creating translations of other plugins and themes.  WPML offers integration to a translation service.© 2012 Rick Radko, r3df.com 69
  • 71. Multilingual with multisiteHistorically single site with plugins has been themost popular technique, but:  Since WordPress 3.0 we have had multisite (network) in the standard version of WordPress.  Multisite allows you to have what appear to be multiple different WordPress sites running on one install of WordPress.  Different themes.  Different URL‟s (if you want)  You would not know it‟s one WordPress.© 2012 Rick Radko, r3df.com 70
  • 72. Multilingual with multisite continuedUsing multisite allows:  A “single” site approach.  But removes many of the negative issues with independent single site installs.© 2012 Rick Radko, r3df.com 71
  • 73. Installing multisiteTo enable multisite, you need to perform a shortsequence of steps, which include:  Dashboard setting changes.  Cutting and pasting some provided settings into configuration files.There are many guides to walk you through theprocess:  http://codex.wordpress.org/Create_A_Network  http://halfelf.org/ebooks/wordpress-multisite-101/© 2012 Rick Radko, r3df.com 72
  • 74. Adding languages to multisiteYou can start your multisite install with any versionof WordPress.  If you use a localized version that will give you one language plus English.  The sample content is in the localized language.To add more languages you need to:  Install the language files manually.  Use the Codestyling Localization plugin.*See “Installing WordPress language files” in the appendix.© 2012 Rick Radko, r3df.com 73
  • 75. Setting multisite languages Once you have language files installed:  An option for site language will appear in the Settings -> General section.  It‟s also in the network admin site settings.© 2012 Rick Radko, r3df.com 74
  • 76. Multilingual with multisite issues  More complicated to install multisite WordPress  Not as simple as the regular 5-min install.  But is not hard either – maybe 10 minutes  Some plugins don‟t run on multisite.  Some duplication of effort to manage sites.  Plugins may need to be configured on each site.  Plugins that store their own data may have separate datasets on each site. This could be an issue for something like registration systems.© 2012 Rick Radko, r3df.com 75
  • 77. More multisite issues  Separate dashboards for each language site.  But there usually is only one login.  Not quite as easy to manage content.  No language connection between content items.  This can be resolved with Language Switcher Plugins for multisite.© 2012 Rick Radko, r3df.com 76
  • 78. Language switcher pluginsThese plugins help relate content items betweenthe sites and provide widgets for front-end linksbetween different language versions of content.Language switcher plugins:  Multisite Language Switcher  Multilingual Press  More?© 2012 Rick Radko, r3df.com 77
  • 79. Multilingual with multisite benefits  Reduced dependency on the plugins.  If you remove or disable a plugin used to manage language switching, all the sites still work, you just loose the linking between them.  Each site behaves as if it is a single site:  You don‟t need a plugin to manage the front-end site display.  Fewer plugin conflicts.  Sites run normally, no tricks.© 2012 Rick Radko, r3df.com 78
  • 80. Multilingual considerations  Splash page for language choice  Multilingual home page (allows language choice)  Browser or location sniffing – Don‟t!  Merged comments on symmetric content?  Merged is default with qTranslate,  Need plugins for other approaches.  Google (SEO) -> dont mix languages.  Best practice -> one language per page.© 2012 Rick Radko, r3df.com 79
  • 81. Multilingual considerationsDomains/url‟s (example pairs for bilingual French)  Single installs site only  yourdomain.com?lang=en  yourdomain.com?lang=fr© 2012 Rick Radko, r3df.com 80
  • 82. Multilingual considerations  Any install type:  yourdomain.com or yourdomain.ca  yourdomain.fr  yourdomain.com/en  yourdomain.com/fr  en.yourdomain.com  fr.yourdomain.com© 2012 Rick Radko, r3df.com 81
  • 83. ContactRick Radko  email: wpinfo@r3df.com  twitter: @r3designforgeSlides at:  www.slideshare.net/r3df© 2012 Rick Radko, r3df.com 82
  • 84. Appendix© 2012 Rick Radko, r3df.com 83
  • 85. LinksWordPress in Your Language  http://codex.wordpress.org/WordPress_in_Your_Lang uageInstalling WordPress in Your Language  http://codex.wordpress.org/Installing_WordPress_in_ Your_LanguageMultilingual WordPress  http://codex.wordpress.org/Multilingual_WordPressTranslating WordPress  http://codex.wordpress.org/Translating_WordPress© 2012 Rick Radko, r3df.com 84
  • 86. LinksGlotpress  http://translate.wordpress.org/getting-started  http://blog.glotpress.org/  http://translate.wordpress.org/projects© 2012 Rick Radko, r3df.com 85
  • 87. Internationalization digging deeper© 2012 Rick Radko, r3df.com 86
  • 88. Checking the files for internationalization  Look in the plugin or theme folder for folders called:  Languages  Language  Lang  i18n  Check for .pot, .mo and .po files.  If any these files exist, then you can create a translation.© 2012 Rick Radko, r3df.com 87
  • 89. Internationalization still not obvious? Go deeperIf you are really desperate for a plugin or theme ina language and there is no indication that it isinternationalized:  You can check the code for things like:  __(<some text>, some domain)  _e(<some text>, some domain)  If they exist, you may be able to localize it.  You will need to create you own .pot file  This may require a lot of effortFor more info see:http://codex.wordpress.org/I18n_for_WordPress_Developers© 2012 Rick Radko, r3df.com 88
  • 90. What are __() and _e()?__() and _e() are the magic in the WordPress codethat lets localization work.Example: __(„Hello‟, „twentyeleven‟)  Means look for “Hello” in the language files for the Twenty Eleven theme, for current locale, say fr_FR. That would then return “Bonjour” if the files are loaded, and “Hello” if they are not.For more info see:http://codex.wordpress.org/I18n_for_WordPress_Developers© 2012 Rick Radko, r3df.com 89
  • 91. Creating your own translations© 2012 Rick Radko, r3df.com 90
  • 92. You need .pot, .mo. or .po files to start.POT (Portable Object Template) files are createdby the developer they have all text in the __() or_e() functions..PO (Portable Object) files are plain text files thatlist all the translation pairs. #: wp-admin/includes/upgrade.php:213 msgid "Hello world!“ msgstr "Bonjour tout le monde&nbsp;!“.MO (Machine Object) files are compiled versionsof the .po files.© 2012 Rick Radko, r3df.com 91
  • 93. You need .pot, .mo. or .po files to startIf you can‟t find a .pot, .mo, or .po file for theplugin or theme you want to translate:  Don’t try to translate it!  Try another theme, or plugin.WordPress .pot files, and other .mo, and .po filesthat you can use as starting points are of courseavailable.© 2012 Rick Radko, r3df.com 92
  • 94. Change existing .mo. or .po filesYou can often start with an existing .mo or .po fileand just change what you need.  If there is something close:  Canadian vs France French  If you only need to change a few items  Tweet BlenderSee: http://codex.wordpress.org/I18n_for_WordPress_Developersfor a lot of important details like naming conventions for your files.© 2012 Rick Radko, r3df.com 93
  • 95. Editing translation files2 editors I use are:  Poedit - the most commonly mentioned http://www.poedit.net/  available for Windows, Mac and Linux  Virtaal http://translate.sourceforge.net/wiki/virtaal/index  Has translation help  Lets you add terms  available for Windows, Mac and Linux*For a complete list of tools see:http://codex.wordpress.org/Translating_WordPress#Translation_Tools© 2012 Rick Radko, r3df.com 94
  • 96. Poedit© 2012 Rick Radko, r3df.com 95
  • 97. Adding your language files to plugins & themesTo install new language files for plugins & themes,add them to the language folder you found whenchecking out the plugin or theme.Folders called:  Languages  Language  Lang  i18n*Use the same naming convention for your files as the theme orplugin.**Use your hosts cPanel or FTP functions.© 2012 Rick Radko, r3df.com 96
  • 98. Installing WordPress language files© 2012 Rick Radko, r3df.com 97
  • 99. Find the language filesFind the needed language files on:  http://codex.wordpress.org/WordPress_in_Your_L anguage OR  http://i18n.svn.wordpress.org/If the only version on “WordPress in YourLanguage” is an installer version, it may be easierto get them out of the .zip file than to find them onhttp://i18n.svn.wordpress.org/.© 2012 Rick Radko, r3df.com 98
  • 100. Add the files to your WordPress installFor WordPress to find your language files, theyneed to be put in the folder at:  <your-site-root>/wp-content/languages/The official instructions:  http://codex.wordpress.org/Installing_WordPress_ in_Your_Language© 2012 Rick Radko, r3df.com 99