Translation is among the most extremely requested matters within the WPMU DEV assist boards, and it’s no surprise. In response to latest statistics, WordPress is obtainable in 205 languages.
71% of WordPress’s printed pages use English of their content material. That’s lots of people who most likely 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 subsequent week we’ll function a brand new submit day-after-day on translating completely different facets of WordPress. When you have any requests please me know within the feedback under.
On this first submit I’ll present you how one can translate a translation-ready theme.
Discovering a Theme Able to Translate
Translating Utilizing Poedit
Setting Up Your Translated Theme in WordPress
Translation Ideas
This submit is a part of our Translation Week sequence. Try the opposite posts on this sequence right here:
The right way to Translate a WordPress Theme
The right way to Localize a WordPress Theme and Make it Translation Prepared
The right way to Set Up the WordPress Backend in Your Language
The whole lot You Have to Know About Translating WordPress Plugins
Collaborative Translations Now Accessible for WPMU DEV Merchandise
The right way to Translate a WordPress Plugin
Prime 6 Translation Plugins for Your WordPress Website
Discovering a Theme Able to Translate
First issues first, you’ll must discover a theme to translate. However you possibly can’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 how one can make your themes translation prepared.
Builders don’t all the time create translation prepared themes, so if you’re shopping for a premium theme be sure that to ask if it’s translation prepared.
In case you simply desire a free theme, it’s simple to seek for translation prepared designs within the WordPress Theme Repository.
Go to the WordPress.org Themes repository.
Click on on the Function Filter cog icon.
Beneath 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 contains tags for locating translation prepared themes.
When you’ve obtained your theme, open up the zip file and discover the language folder. It ought to comprise a POT file.
WordPress makes use of the GNU gettext localization framework for translation. There are three sorts of recordsdata used within the framework:
POT (Transportable Object Template) recordsdata: Step one within the translation course of is utilizing a program to look by way of the WordPress supply code to pick textual content handed right into a __() or __e() operate, producing a POT file. This file will comprise all of the textual content obtainable for translation.
PO (Transportable Object) recordsdata: 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) recordsdata: Within the final step, the PO file is transformed right into a machine readable format.
Translating Utilizing Poedit
There are a couple 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 obtainable 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 wish to translate right here.
Enter the language you wish to translate, and every other particulars, then click on OK.
4. Afterwards, you’ll be requested what you wish to identify your translation file. The identify is essential and there’s a specific format you have to to observe. For instance, for those who’re translating Chinese language for China, the file ought 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 particular code you have to to make use of when saving translation recordsdata. This code signifies Tagalog for the Philippines.
Try the GNU `gettext’ utilities to seek 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 easy interface that doesn’t contain a steep studying curve. The house on the high will show all of the textual content able to translate, and any accomplished translations will show to the fitting. The bins beneath present the supply textual content you’ve chosen to translate, your translation and any notes for translators.
It’s simple to cycle by way of 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. While you’ve completed translating, merely save your file. Poedit will routinely create each .po and .mo recordsdata in your theme’s languages folder.
7. Now that your theme has been translated, you possibly can 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 have to to play with just a little code to pressure WordPress to make use of your translated recordsdata.
With the intention to do that, you have to 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 wish to use translation recordsdata 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 in your WordPress backend in one other submit as a part of this sequence this week.
Translation Ideas
The WordPress Codex gives some stable suggestions for translation that anybody translating WordPress ought to take note:
Don’t translate actually, translate organically: Languages have completely different constructions, rhythms, tones, and inflections. Translated textual content don’t must be structured the identical method because the English ones: take the concepts which can be offered and give you a message that expresses the identical factor in a pure method for the goal language.
Attempt to maintain 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: In case you get caught or want path, attempt studying by way of the translations of different in style software program to get a really feel for the way they’ve tackled translations.
Editor’s Notice: This submit 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!