People from all over the world will buy from you if you have an eCommerce business. As a business owner, you need to make sure that people who don’t speak English are comfortable while looking for the product they want. So, a WordPress theme translation is a must if you want your online store sales to grow.
Do you want to translate the site’s theme for visitors and interact with them? Then you should read this article.
In this article, we’ll try to explain how to figure out which languages your website needs and, more importantly, how to do the translation to a theme quickly and easily through wordpress.
Why Should Think About Doing a Translation to Your WordPress Theme?
There are WordPress users all over the world. So localization and internationalization are important for the WordPress theme. If you have a WordPress theme that is only available in one language, it can be hard to build a site that works in more than one language.
Also, you should keep in mind that not all themes are ready to be translated. Let’s say you have a theme ready to be translated. In this case, you might run into some oddities that make it hard to make a fully multi-language theme.
How to Figure Out Which Languages to Use
The most important part of executing a translation to a theme in wordpress is to know who the audience is and what language they prefer. Let’s look at what you need to find out about for this translation.
1- Do a market analysis to figure out who you want to reach.
If you want to run an eCommerce business, you need to figure out from which country you get the most customers. By setting their language in your store, you can make it easier for them to shop there. You can use it as a way to connect with customers, increase your market value, and get them to know you.
2- Find out who your competitors are and where they come from.
It is smart to look at your competitors, where they come from, and how they handle traffic from outside their country. The owner of an eCommerce site has to be more forward-thinking than his or her competitors.
3-Find out how many people speak the language as their first language.
Another way to decide which language to use is to look at the list of languages in order of how many native speakers there are. This will help you decide what language is most important on your website.
4- Check the sales numbers of the group of people you want to buy from.
When you know where your clients feel most comfortable, you can be more reliable to them. So, looking at the sales history of a customer can help you figure out what language is most comfortable for them.
Theme Translation for WordPress: 5 Steps Easy Guide
Going multilingual is a great choice if you want to attract people from all over the world. eCommerce business owners need to have a plan for how to translate themes.
In this part of the article, we’ll try to explain the steps you need to take to translate your theme into the language you want.
Step 1: Add the function load theme textdomain
First, there must be a function in the functions.php file. It will look for “for locale.mo and load it” in your theme directory.
Now, add this function to the functions.php file:
load theme textdomain( ‘framework’, get template directory() . ‘/lang’ );
Here, you don’t need to type “framework.” Instead, type the name of your theme. Just keep it as one word to make sure nothing goes wrong.
Change the path for Template. This is the last part of the first step. It will be the place where.po and.mo files are kept.
Step 2: Make the theme fit the area
At this step, you have to turn all of your text strings into functions. You’ll need to change your theme. Don’t worry, it won’t be that hard.
Just replace any text in your theme with the word functions. Now, those doing the translation will know which texts will be changed.
- Change how echo works
Instead of using the echo function to show text,
Use the function _e(‘ ‘):
- Change “naked” strings
Instead of “naked strings,”
?php echo ‘Some string’;?>
Use the _(“) function to:
?php echo ‘h2>’; __(‘Some string’, ‘framework’);?>
- Replace normal text
In place of normal text
Hi, I’m Text.
Use the function _e(“):
“Hello, my name is Text,” “framework,”
Step 3: Add textdomain to functions.php and make.po and.mo files.
Your main idea is all set. Now, make files with the extensions.po and.mo that will be used for translation.
Now that your theme is ready, you can make the.po and.mo files that are used for translation. We are using the Poedit program to show you the tutorial in the right way.
- Open Poedit> Click File, then New Catalog.
- Type in a Name to get information about a specific Project (the name of your theme is fine)
- Click on Paths and type in the path to the files that need to be translated. We put the.po and.mo files in the theme’s “lang” folder, so the base bath is../
- Click Keywords and type “_” and “_e” for the keywords (You have used them in step 2 for localizing the theme)
- Save the default.po file in the “lang” folder of your theme.
Step 4: Change the.po file’s language and make a new.mo file
Do you want to give your theme away for free or sell it? If yes, then you can just add the default.po and.mo files and you’re done.
If, on the other hand, your main goal is to translate the theme, you can edit the default.po file to add your translations.
- Translate the file named default.po
Now, open the default.po file in Poedit and add your translations for each value (click on a string of text and enter the translation below like shown in the image).
- Keep the Translation File with the Current File
Now, save the translated.po file by giving it a specific name.
The naming convention should be based on the language code (for example, bn for Bengali) and the country code (for example, _BR for Brazil). So, the file for Brazil will be called bn BR.mo.
Look at the whole list of language codes and country codes to figure out where you are.
- File Translated to Bangla as an Example
bn BR.po bn BR.mo
As you can see from the examples, if you save, both the.po and.mo files will be made automatically.
- Put a new.mo file in the “lang” folder of the theme
The.mo file you made in Part B needs to go into the lang folder of your theme (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 there.
Questions you might be thinking about
How can I make a WordPress theme speak a different language?
Answer: First, go to Settings > General in your WordPress dashboard after logging in. Choose the language you need to use in the Site Language list, and don’t forget to click Save Changes.
Can WordPress sites be in more than one language?
Answer: No, WordPress does not support a blog that is written in two or more languages. But the WordPress community has a lot of plugins that make it easy to make a blog that is written in more than one language.
What is Loco Translate, and how does it work?
Answer: Loco Translate is a free plugin for WordPress that lets you edit WordPress translation files right in the browser. It can help you change the language of your WordPress theme or plugins.
What is a website that has more than one language?
A website that can be read in more than one language is called a multilingual website. A website with more than one language can bring in more customers than one with only one language.
How do I change the language of a Shopify theme?
Answer: It’s normal that you can’t find the language you need on your site. Here, translations are at the top. Through the Shopify admin, you can see which languages a theme is available in.
Go to Online Store >Themes to find out how. Click Actions and then Edit language. Then click Change the language of the theme and choose the language.
Phew! So, that’s the end of our wordpress theme translation guide. Do research on the market and follow our steps before you translate!