Instructions for using Loco Translate to Vietnameseize the WordPress theme

Tutorials 0 lượt xem

WordPress themes and plugins are all in English.

If you use them for a Vietnamese site, you must Vietnameseize them.

But don’t you worry? Vietnameseizing them is very easy.

The Loco Translate plugin makes Vietnameseizing your themes and plugins as easy as eating porridge.

  • Note : You can use PoEdit to Vietnameseize the theme/plugin. Compared to Loco Transalte, PoEdit is not as convenient.

In this article, I will Vietnameseize the TrueReview Theme , a theme in the Theme Junkie set that I am using. This is a theme that has a .pot file for you to be ready to Vietnameseize.

loco-translate-2

The process of Vietnameseization I guide below also applies to other plugins or themes.

Before starting to Vietnameseize the theme, you need to know some of the following knowledge.

Introduction to translate in WordPress

When talking about translate in WordPress, it’s really about two things.

First, it is translating the website content. Translating content including posts, pages, and so on is the way to build a multilingual site. If you want to translate the content, you can use the free plugin Polylang

The second one is the translate text strings that the theme and plugin use

An example of such text strings would be the word ” Related Article ” that the TrueReview theme uses before related articles. This article guides you to Vietnameseize such text strings.

loco-translate-10

Understanding .POT, .PO, and .MO formats in a translate theme or plugin

POT file (portable object template) : The POT file acts as the template for the PO file mentioned below. They contain the content (text string) in English language used in the theme or plugin.

Theme or plugin developers will scan the entire PHP source file to generate this file. You can find this file in the language folder of your theme or plugin.

Below is the content of the pot file of the TrueReview theme that I opened with PoEdit.

loco-translate-11

PO file (portable object) : this is a file containing the original English text in one column and the translation in the second column. Each language has its PO file, for example the PO file for Vietnamese would be vi.po ​​file. (vi is the language code, refer to the list of language codes here ).

Below is the content of the .PO file of the TrueReview theme. You will see the original text in Source Text and the translated text if available in Translation. In this tutorial, Loco Translate will automatically generate the PO file for us

loco-translate-9

MO file (machine object) : file containing binary content that only the machine can understand. This file is generated from the PO file. WordPress will read this file, not the PO file, to display language-appropriate text.

  • Note : With Loco Translate, the plugin/theme that needs to be Vietnameseized must have a PO or POT file.

Change WordPress language to Vietnamese

First you make sure that the WordPress version has changed to Vietnamese. Go to Settings -> General . Scroll down, in the Site Language section, select Vietnamese. Click ‘ Save Changes ‘ to save the changes.

  • Note : WordPress from version 4, you do not need to configure the language using the WPLANG variable in the wp-config.php file.
loco-translate-1

Vietnameseize the theme using Loco Translate

Next, you install the Loco Translate plugin . If you do not know how to install the plugin see here . 

After installation, go to Loco Translate -> Theme . Select the theme you need to Vietnameseize.

On the next screen, click the  New language button to create a new language.

loco-translate-3

The next step is to select Vietnamese from the list of languages. The location you choose is custom to ensure that the localization is not lost when WordPress or the theme automatically updates. Click the Start translating button to start translating the theme

loco-translate-4

In the editor screen for localization, you will see all the strings defined in the theme’s pot file (Trueview.pot). These Strings display in the source text frame.

Uncompiled Strings will be darker green than compiled strings.

To Vietnameseize, you use the filter box to find the String you need to Vietnameseize. Then you enter the Vietnamese part in Vietnamese translation. After the translation is complete, you will notice that the String in the Source Text section has a star icon next to it. It informs you which Strings have been compiled but not yet saved

loco-translate-7

You just need to Vietnameseize which Strings are displayed on the homepage. No need to fully Vietnameseize. Strings that are not Vietnameseized will of course display in English language

After Vietnameseization, remember to click the Save button to save it.

Now, we go to the screen and check if the String has been successfully Vietnameseized.

loco-translate-8

Epilogue

How to use Loco Translate simple right?

If you have any difficulty with the plugin, leave a comment below.

Currently, Woocomerce is having a problem that has not been fully Vietnameseized, you can download the full translation HERE. 

Bài viết liên quan