If you have an eCommerce business, you will have customers from different areas of the world. As an entrepreneur, you have to ensure that non-English persons feel comfortable while looking for their desired product. Thus, WordPress theme translation is a necessary part of online store sales growth.
Are you one of them who wants to translate the theme for site visitors and engage with them? Well, then this article is for you.
In this article, we will try to cover how you can determine which languages are needed for your website and most importantly the easy ways to translate a theme.
Why Should Consider WordPress Theme Translation
All over the globe, you will find WordPress users. So localization and internationalization are essential for WordPress themes.
If you have a theme that is only available in a single language, it can make the situation difficult where you need to build a multilingual WordPress site.
Moreover, you should remember that all themes are not ready for translation. Suppose you have a theme that is ready for translation. In this situation, you may face some quirks that will make it difficult to build a fully multi-language theme.
How to Determine the Right Languages
Understanding the target audience and their preferred language is the most important part of a theme translating. Let's see what you should research for this translation.
1- Market Analysis to Set Your Target Audience
For running an eCommerce business, you must analyze in which country you are getting the largest amount of customers. You can make their buying journey more comfortable by setting their language in your store.
You can follow it as a customer engagement strategy to increase your market value and make them familiar with you.
2- Know Who are Your Competitors and Where are They From
It is a wise decision to analyze your competitors, their origin, and how they are handling their country outside traffic. An eCommerce site owner has to be more futuristic than his/ her business opponents.
3- Find out the Number of Native Speakers of the Language
There is another way to decide the language by checking the list of languages by the number of native speakers. This will help you to specify the essential language on your website.
4- Check the Sales Statistics of Your Target Customer Group
You can be more reliable to your clients when you know their comfort zone. Thus, analyzing customers' past sales statistics can help you to determine their convenience language.
WordPress Theme Translation: 5 Steps Easy Guide
Going multilingual for your different visitors from multiple places in the world is a great decision. eCommerce entrepreneurs must have plans for theme translating.
In this part of the article, we will try to show you the steps to translate your theme into your desired language.
Step 1: Add The load_theme_textdomain Function
Firstly, the functions.php file must include a function. It will seek your theme directory for “for locale.mo and load it”
Now, include the following function to functions.php:
load_theme_textdomain( 'framework', get_template_directory() . '/lang' );
Here, ‘framework’ is not necessary, you type your theme name. Just keep it as 1 word for assuring no issues.
The last part of this first step is to change the path for Template. It will be the location where .po and .mo files will be stored.
Step 2: Localizing The Theme
In this step, you have to change all your text strings into functions. For that, you have to edit your theme. Don't get afraid, it's not that hard.
Just change all the text used in your theme to functions. Now, the translation will know which texts will be replaced for translation.
Change echo functions
Rather using echo functions for showing text-
<?php echo 'Some string'; ?>
Use the _e(‘ ‘) function:
<?php _e( 'Some string', 'framework' ); ?>
Change “naked” strings
Rather using “naked strings”-
<?php echo '<h2>Some string</h2>'; ?>
Use the _(”) function:
<?php echo '<h2>' . __('Some string', 'framework') . '</h2>'; ?>
Change regular text
Instead of regular text
Hi I am Text
Use the _e(”) function:
<?php _e('Hi I am Text','framework')
Step 3: Add Textdomain To Functions.php and Create .po & .mo Files
Your theme is ready. Now, create .po and .mo files which will be used for translation
Now that your theme is ready you can create the .po and .mo files that are used for translation. To show you the tutorial properly, we are using the Poedit program.
1. Open Poedit> Click on File> New Catalog
2. For specific Project information enter a Name (the name of your theme is fine)
3. Click on Paths and enter the path for the files which needed to be translating. We put .po and .mo files in a “lang” folder in the theme so the base bath is ../
4. Click Keywords and enter “_” and “_e” for the keywords (You have used them in step 2 for localizing the theme)
5. Lastly, save the default .po file into your theme’s “lang” folder.
Step 4: Translate The .po File & Create A New .mo File
Do you want to sell your theme or give away for free? If yes, then you are done by just including the default .po and .mo files.
On the other hand, if your main purpose is to translate the theme then edit the default.po file to attach your translations.
Translate the default.po File
Now, open the default.po file in Poedit and enter your translations for each value (click on a string of text and enter the translation below like shown in the image).
Keep the Current File with Translation
Now, by using a specific naming convention save the translated .po file.
The naming convention should be based on the language code (Suppose bn for Bengali) followed by the country code (Suppose _BR for Brazil). So, the Brazilian Bangladesh file will call bn_BR.mo.
To find your exact locale, view the entire list of language codes and country codes.
Example File Translated To Bangla
As you can see the examples, if you save it will automatically produce both the .po and .mo files.
Add New .mo File to Theme’s “lang” Folder
The .mo file created in part “b” needs to go into your theme’s lang folder (or wherever you defined it in step 1 of the tutorial).
Step 5: Change the Language
Just go to Settings >General and change the Site Language option.
Questions that May Have on Your Mind
Question 1: How can I change the language of a WordPress theme?
Answer: Firstly, log in to your WordPress dashboard and go to Settings > General. In the Site Language list, choose the language you need to use, and don't forget to click Save Changes.
Question 2: Does WordPress allow multilingual sites?
Answer: Truly WordPress does not support a bilingual or multilingual blog. But there are plenty of Plugins in the WordPress community which will enable you to build a multilingual blog effortlessly.
Question 3: What is Loco Translate?
Answer: Loco Translate is a free WordPress plugin that offers in-browser editing of WordPress translation files. It is useful for changing your WordPress theme or plugins in a different language.
Question 4: What is a multilingual website?
Answer: Which website is available in multiple languages is called a multilingual website. A multilingual website can bring more customers than a single lingual website.
Question 5: How can I translate a theme in Shopify?
Answer: It's quite normal that you are not getting your needed language on your site. Here translations come first. Through your Shopify admin, you can see the available languages for a theme.
The way is to go to Online Store >Themes. Now click Actions > Edit language. Then click Change theme language and select the language.
Phew! So that is our tutorial for theme translation. Before translating, always do market research and follow our steps.
Have you translated your theme by following the steps above? If you have done it, then Congratulations! And, don't forget to share it with us if you are not successful.