Translation is among the maximum extremely asked subjects within the WPMU DEV fortify boards, and it’s no marvel. In keeping with recent statistics, WordPress is to be had in 205 languages.
19. 71% of WordPress’s printed pages use English of their content material. That’s numerous individuals who most likely discuss English as a 2d language―and likewise individuals who increase web pages for many who would possibly now not discuss English in any respect.
As such, we’re kicking off a sequence on translating WordPress. Over the following week we’ll characteristic a brand new submit on a daily basis on translating other facets of WordPress. In case you have any requests please me know within the feedback beneath.
On this first submit I’ll display you how you can translate a translation-ready theme.
- Finding a Theme Ready to Translate
- Translating Using Poedit
- Setting Up Your Translated Theme in WordPress
- Translation Tips
This submit is a part of our Translation Week collection. Take a look at the opposite posts on this collection right here:
- How to Translate a WordPress Theme
- How to Localize a WordPress Theme and Make it Translation Ready
- How to Set Up the WordPress Backend in Your Language
- Everything You Need to Know About Translating WordPress Plugins
- Collaborative Translations Now Available for WPMU DEV Products
- How to Translate a WordPress Plugin
- Top 6 Translation Plugins for Your WordPress Site
Discovering a Theme In a position to Translate
First issues first, you’ll want to discover a theme to translate. However you’ll be able to’t simply translate any previous theme – you wish to have a theme that has been localized the use of the GNU gettext framework. In different phrases, the theme is able to be translated. In case your theme hasn’t been localized, come again later this week for a run down on how you can make your subject matters translation waiting.
Builders don’t all the time create translation waiting subject matters, so while you’re purchasing a top rate theme be sure to ask if it’s translation waiting.
In the event you simply desire a loose theme, it’s simple to seek for translation waiting designs within the WordPress Theme Repository.
Move to the WordPress.org Themes repository.
- Click on at the Characteristic Clear out cog icon.
- Beneath Options, scroll right down to Translation In a position on the backside, and click on to checkmark the field subsequent to it.
- Then head again to the highest of the web page, and click on on Observe Filters.
When you’ve were given your theme, open up the zip report and in finding the language folder. It must include a POT report.
WordPress makes use of the GNU gettext localization framework for translation. There are 3 kinds of information used within the framework:
POT (Moveable Object Template) information: Step one within the translation procedure is the use of a program to go looking during the WordPress supply code to pick textual content handed right into a
__e() serve as, producing a POT report. This report will include all of the textual content to be had for translation.
PO (Moveable Object) information: The second one step comes to translating the textual content in a POT report into the objective language, saving each English and translator messages in a PO report.
MO (System Object) information: Within the closing step, the PO report is transformed right into a device readable structure.
Translating The usage of Poedit
There are a couple of other choices for translating WordPress, as defined within the WordPress Codex. For this educational, we’re going to make use of Poedit, a very easy to make use of open supply program to be had for Mac OS X, Home windows and UNIX/Linux.
1. Set up Poedit.
2. Open Poedit and pass to Report > New catalog from POT report and choose the POT on your theme’s languages folder.
3. A catalog homes field will pop up requesting details about what you’re translating. Input the language you wish to have to translate right here.
4. Afterwards, you’ll be requested what you wish to have to call your translation report. The title is vital and there’s a specific structure it is very important observe. As an example, in the event you’re translating Chinese language for China, the report must be title zh_CH.po, and for a Tagalog translation for the Philippines can be tl_PH.po
Take a look at the GNU `gettext’ utilities to search out your language and nation codes.
Save your report within the languages folder of your theme.
5. Now you’ll be able to get started translating your theme. Poedit has a easy and easy interface that doesn’t contain a steep finding out curve. The distance on the most sensible will show all of the textual content waiting to translate, and any finished translations will show to the appropriate. The packing containers beneath display the supply textual content you’ve decided on to translate, your translation and any notes for translators.
Translating a line of textual content is truly simple―simply choose a phrase or word, input your translation and click on Replace.
6. Whilst you’ve completed translating, merely save your report. Poedit will robotically create each .po and .mo information on your theme’s languages folder.
7. Now that your theme has been translated, you’ll be able to add it on your WordPress set up both using FTP or by way of logging into your WordPress web site and importing your theme by way of going to Look > Topics, then clicking at the Upload New button (after you’ve zipped your theme, after all).
Environment Up Your Translated Theme in WordPress
As English is the default language for WordPress, it is very important play with a bit code to power WordPress to make use of your translated information.
With a view to do that, it is very important FTP into your WordPress set up and open up the wp_config report and upload this line of code:
outline ('WPLANG', 'zh_CN');
This line specifies Chinese language for China, so that you’ll want to change zh_CN together with your language and nation code.
Including this line tells WordPress you wish to have to make use of translation information for Chinese language. Because you’ve translated most effective your theme and now not your backend, your web site will show in Chinese language however your WordPress admin space will proceed to show in English.
I’ll duvet converting the default language to your WordPress backend in some other submit as a part of this collection this week.
The WordPress Codex provides some solid tips for translation that any one translating WordPress must remember:
Don’t translate actually, translate organically: Languages have other constructions, rhythms, tones, and inflections. Translated textual content don’t want to be structured the similar method because the English ones: take the tips which can be introduced and get a hold of a message that expresses the similar factor in a herbal method for the objective language.
Attempt to stay the similar stage of ritual (or informality): Attempt to accomplish the identical within the goal language, inside of your cultural context.
Don’t use slang or audience-specific phrases: Keep away from colloquialisms and to stay with what you assume a brand new blogger would perceive.
Learn different device’s localizations on your language: In the event you get caught or want course, check out studying during the translations of alternative widespread device to get a really feel for the way they’ve tackled translations.
Editor’s Word: This submit has been up to date for accuracy and relevancy.
[Originally Published: October 2013 / Revised: March 2022]