Translation is among the most extremely requested subjects within the WPMU DEV help boards, and it’s no surprise. Based on current statistics, WordPress is on the market in 205 languages.
19. 71% of WordPress’s revealed pages use English of their content material. That’s lots of people who in all probability converse English as a second language―and in addition individuals who develop web sites for individuals who won’t converse 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 put up on daily basis on translating completely different facets of WordPress. When you have any requests please me know within the feedback beneath.
On this first put up I’ll present you the right way to translate a translation-ready theme.
Discovering a Theme Able to Translate
Translating Utilizing Poedit
Setting Up Your Translated Theme in WordPress
Translation Suggestions
This put up is a part of our Translation Week sequence. Try the opposite posts on this sequence right here:
Find out how to Translate a WordPress Theme
Find out how to Localize a WordPress Theme and Make it Translation Prepared
Find out how to Set Up the WordPress Backend in Your Language
Every part You Must Know About Translating WordPress Plugins
Collaborative Translations Now Out there for WPMU DEV Merchandise
Find out how to Translate a WordPress Plugin
High 6 Translation Plugins for Your WordPress Website
Discovering a Theme Able to Translate
First issues first, you’ll have to discover a theme to translate. However you may’t simply translate any previous theme – you want a theme that has been localized utilizing 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 the right way to make your themes translation prepared.
Builders don’t at all times create translation prepared themes, so while you’re shopping for a premium theme be certain that to ask if it’s translation prepared.
For those who simply need a free theme, it’s straightforward to seek for translation prepared designs within the WordPress Theme Repository.
Go to the WordPress.org Themes repository.
Click on on the Characteristic Filter cog icon.
Below Options, scroll all the way down to Translation Prepared 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 Apply Filters.
The WordPress Theme Repository consists of tags for locating translation prepared themes.
When you’ve received your theme, open up the zip file and discover the language folder. It ought to include a POT file.
WordPress makes use of the GNU gettext localization framework for translation. There are three varieties of information used within the framework:
POT (Transportable Object Template) information: Step one within the translation course of is utilizing a program to go looking via the WordPress supply code to pick textual content handed right into a __() or __e() perform, producing a POT file. This file will include all of the textual content accessible for translation.
PO (Transportable Object) information: The second step entails translating the textual content in a POT file into the goal language, saving each English and translator messages in a PO file.
MO (Machine Object) information: Within the final step, the PO file is transformed right into a machine readable format.
Translating Utilizing Poedit
There are a number of completely different choices for translating WordPress, as outlined within the WordPress Codex. For this tutorial, we’re going to make use of Poedit, a simple to make use of open supply program accessible for Mac OS X, Home windows and UNIX/Linux.
1. Set up Poedit.
2. Open Poedit and go to File > New catalog from POT file and choose the POT in your theme’s languages folder.
3. A catalog properties field will pop up asking for details about what you might be translating. Enter the language you need to translate right here.
Enter the language you need to translate, and another particulars, then click on OK.
4. Afterwards, you’ll be requested what you need to identify your translation file. The identify is necessary and there’s a specific format you will want to observe. For instance, when you’re translating Chinese language for China, the file needs to be identify zh_CH.po, and for a Tagalog translation for the Philippines could be tl_PH.po
Every language and nation has a selected code you will want to make use of when saving translation information. This code signifies Tagalog for the Philippines.
Try the GNU `gettext’ utilities to search out your language and nation codes.
Save your file within the languages folder of your theme.
5. Now you can begin translating your theme. Poedit has a easy and simple interface that doesn’t contain a steep studying curve. The house on the prime will show all of the textual content able to translate, and any accomplished translations will show to the best. The bins beneath present the supply textual content you’ve chosen to translate, your translation and any notes for translators.
It’s straightforward to cycle via the textual content and enter your translations.
Translating a line of textual content is very easy―simply choose a phrase or phrase, enter your translation and click on Replace.
6. Once you’ve completed translating, merely save your file. Poedit will mechanically create each .po and .mo information in your theme’s languages folder.
7. Now that your theme has been translated, you may add it to your WordPress set up both utilizing FTP or by logging into your WordPress website and importing your theme by going to Look > Themes, then clicking on the Add New button (after you’ve zipped your theme, in fact).
Setting Up Your Translated Theme in WordPress
As English is the default language for WordPress, you will want to play with a little bit code to pressure WordPress to make use of your translated information.
So as to do that, you will want to FTP into your WordPress set up and open up the wp_config file and add this line of code:
outline (‘WPLANG’, ‘zh_CN’);
This line specifies Chinese language for China, so that you’ll want to switch zh_CN along with your language and nation code.
Including this line tells WordPress you need to use translation information for Chinese language. Because you’ve translated solely your theme and never your backend, your website will show in Chinese language however your WordPress admin space will proceed to show in English.
I’ll cowl altering the default language on your WordPress backend in one other put up as a part of this sequence this week.
Translation Suggestions
The WordPress Codex provides some strong ideas for translation that anybody translating WordPress ought to bear in mind:
Don’t translate actually, translate organically: Languages have completely different buildings, rhythms, tones, and inflections. Translated textual content don’t have to be structured the identical method because the English ones: take the concepts which are offered and give you a message that expresses the identical factor in a pure method for the goal language.
Attempt to hold the identical stage of ritual (or informality): Attempt to accomplish the equal within the goal language, inside your cultural context.
Don’t use slang or audience-specific phrases: Avoid colloquialisms and to stay with what you suppose a brand new blogger would perceive.
Learn different software program’s localizations in your language: For those who get caught or want path, attempt studying via the translations of different standard software program to get a really feel for the way they’ve tackled translations.
Editor’s Notice: This put up has been up to date for accuracy and relevancy.
[Originally Published: October 2013 / Revised: March 2022]
Subscribe to MarketingSolution.
Receive web development discounts & web design tutorials.
Now! Lets GROW Together!