Do you want to localize your WordPress template for your website? Fortunately, you can implement this process and do the WordPress theme localization yourself without the need to hire a programmer or website developer. In this article, we will cover all the information you need.
What is meant by localization of a WordPress template?
Localizing the WordPress template means translating the WordPress template into Arabic and making the writing style coordinated from right to left, so that the user can use the WordPress site to provide content in the Arabic language and target the Arab audience.
This process depends on two main factors, which are the Arabization of all sentences and the translation of all phrases within the WordPress template from English into Arabic, and making the display side from right to left to match that with the Arabic language, and that is what is called the term (RTL) and that is the abbreviation of the following sentence: (Right- to-Left).
These two stages can be implemented in many ways, and each method has a set of steps that you must follow, but your choice of a method depends on the type of template and what is the best suitable step for your template.
Why do you need to localize a WordPress template?
Although the WordPress system comes in more than 160 different languages around the world, all WordPress templates and plugins do not support many languages except for a few templates, which makes you responsible for translating these foreign templates into Arabic so that you can use them in a distinctive and elegant way.
And given that Arabic WordPress templates are very weak and do not provide real value to visitors, foreign WordPress templates are the best and are suitable for many fields, whether your site is a public site, news, or an online store, and in case you want to use these templates for Arabic websites.
You will have to localize the WordPress template and translate it from English into Arabic, and you will only need to follow a set of steps to be able to localize the WordPress template easily and easily from that article as follows.
Also, you will need to localize the WordPress template in the event that you are working in the field of developing WordPress templates or plug-ins for WordPress, then you can learn the steps to localize the WordPress template so that you can offer this service to your customers.
Localization of WordPress templates
WordPress is Arabized
What is a translatable WordPress theme?
It is a template that has been developed more systematically and is compatible with the standards for localization of the WordPress template, where the developer of the template works on the text elements that are used within the template and places them within the source files of the template, especially within some of the functions designated for translation, for example __() or __e ( ) or _n() esc_html __() , and many more.
For example, if the developer wants to add some text strings normally and directly within the source code, he uses the translation function to add that text as shown in the following code:
<?php _e( 'Some string', 'themename' ); ?>
How to know if the template is compatible with translation or not?
In order to be able to know whether this WordPress template is compatible and ready for translation, you must know some information to know that, which we share with you as follows:
1- Read the template specifications
Before undergoing the purchase of a specific template and you want to translate it into Arabic or other languages, you must read the specifications of the template and make sure that the texts and phrases inside it are ready for translation, and to implement this process, go to the site dedicated to purchasing that template and then go to the template page and make sure It is ready for translation and you can use this phrase “Translation Ready” while you are doing the search because it will save you a lot.
2- Ensure that the template files include the translation template file
This step is very important and you must make sure of it if you want to translate a template from one language to another, and to implement this step unzip the template files and search for the translation template file and you will find it in this form (languages) or this form (lang), and it takes the following extension .pot This is an abbreviation for the term (Portable Object Template), and this file includes all template texts and phrases that can be translated into other languages.
This file contributes greatly to facilitating the process of translating the template into other languages later, whether it is Arabic, English, or any other language. Just replace that text inside the file, whatever its language, and put the translated text for the language that you want to display very easily without the need to modify it. Your WordPress theme files and code.
Therefore, in the event that you want to localize your WordPress template, what you have to do is change the translation file and add the language and country that you want to translate to easily, as shown as follows, using the following files:
First, find the file with the following extension. Pot, which is an abbreviation for the following term (Portable Object), and that file is responsible for storing texts and phrases. What you have to do is translate the phrases and texts into the language you want to translate into, then save the file. For example, you translated the template into the Egyptian local Arabic language, so save the file With that title, ar-eg, you can also save the file with the language title only. Adding the name of the country inside the title is not a condition.
After that, make sure that the files include the Machine Object file, which takes the following abbreviation (.mo), and that file is a software file responsible for converting the po translation form file into small formats that are approved and readable automatically so that the user can quickly access all texts Arabic on the website.
Thus, we were able to complete the first step, which is translating all the phrases and texts contained within the template into Arabic, and we made sure that the template includes all files intended for translation into other languages, and we advise you to organize and format these files neatly so that you can refer to them again easier than that.
3- Examine the functions.php file codes inside the template
This file is very important and is available within all WordPress templates. It is one of the basic and very important files as we mentioned earlier. It is called the file dedicated to setting template functions and is used in case you want to modify or add a new function to your template.
And what you must make sure of inside the functions.php file is to ensure that the source code is able to call the following function (load_theme_textdomain) from within the function designated for setting up WordPress templates Setup, so that the text domain functions are loaded and it can understand all files designated for translation and do localization WordPress template, but if you do not find that code, you can add it manually and copy and paste it into the file as follows.
load_theme_textdomain( 'yourthemename', get_template_directory() . '/languages' );
Note: If the hot template is localized by the son template and not the father template, you must add the manual code in this format that we share with you during the following lines:
load_child_theme_textdomain( 'yourthemename', get_template_directory() . '/languages' );
Please change the following word “yourthemename” to the name of the folder in which your website template is located. As for the following word “languages”, it is the name of the folder that includes the three files for translation into Arabic.
Important: Before you modify anything inside the template files or the functions.php file, you must take a backup copy of all your template files. You may encounter a problem that affects the template and makes it work incompletely or not work at all.
How to localize WordPress templates
Are you looking for how to localize a WordPress template? If this is the case, we will get to know together, during the next few lines, the method of localizing the WordPress template, but first you must know a set of points that must be taken into account before starting the process of localizing the WordPress template, which we will learn about together as follows:
In the event that you want to localize the WordPress template, you must be aware of the following programming languages HTML and also CSS , even if that information is only the basics. From you, and you can get that person on online work platforms such as (Freelancer, Fives, Execute for Me, and others), and once you enter these websites, you will find many, many programmers and developers who provide WordPress template localization services in a very distinctive way at a low price.
Using Arabized and ready-to-use WordPress templates without the need to localize WordPress templates and entering a list of steps that are likely to be difficult for beginners, which lead to causing a problem with your website and its codes, in short if you do not have the skill to deal With the programming languages for designing web pages, do not try to localize the WordPress template, because this can be dangerous and disrupt your website.
It is worth noting that the process of Arabizing the WordPress template requires the implementation of some of the steps, and the first step is to translate all the phrases inside the template into Arabic, and that process is called (Localization or Translation), and the second step is to change the direction of all the elements within the theme of your website from the right side to the left side. To match the direction of the Arabic language, it is called (Right-to-Left) and takes the following abbreviation (RTL).
Please note that you must make sure that the template that you want to use supports the RTL system so that you can translate all phrases and change the direction of elements from right to left easily and easily, and most of the time template developers add the feature of translating phrases and changing the reading direction of the Arabic language very smoothly It is integrated with the website and is accessed via the template control panel.
Converting phrases from English into Arabic
This is a very important step, which is translating all the phrases within your website from English into Arabic, and these phrases that explain the functions of the elements within your website, for example the search box, as there is a text inside it called Are you looking for something or something was not found, the requested page is not available, or for example the following, a 404 error or any other text that describes some functionality within the website pages.
Fortunately, this step is very easy and does not require much time and effort from you, and you can use free WordPress plugins and translate all the phrases within your website, and what you have to do is go to the WordPress control panel and install one of the plugins responsible for that and translate the phrases from the language English into Arabic, and that we will get to know with you in the next few lines.
But dear visitor, please note that most template developers do not develop their own templates that are compatible with the translation system, whether it is a free or paid template, and therefore in the event that you want to use a foreign template, you must choose a WordPress template that is ready for translation and is compatible with the translation mechanism and the Arabic language and supports RTL system.
note
In the event that you want to translate a template and that template contains a group of articles or pages such as the privacy policy page or the usage agreement page, you must manually translate these pages using any translation application such as Google Translate.
Tips when localizing a WordPress template
Not translating phrases and texts literally as it appears to you in Google Translate, but reviewing translations and translating texts and phrases in an expressive way that suits the Arabic language.
Use proper and simple Arabic translation so that visitors can understand all the information your website provides to users.
Not to use popular and colloquial terms in your translations, and to translate all phrases and texts in a simple and clear manner.
Now, change the orientation of your website from right to left and make your website support RTL and that direction is very suitable with phrases in Arabic.
wordpress template localization
template localization
The best WordPress theme localization plugins
There are many, many plugins and tools that help you localize the WordPress template, and all manual steps will be implemented automatically as soon as you use one of the programs or plugins that we get to know in the coming lines, which works to set all the following files (po file, mo file and other files for translation Here are the best WordPress template localization plugins:
First: POEDIT WordPress theme localization program
Poedit is a program that gives you the ability to localize the WordPress template completely free of charge, and it comes with a smooth, simple and very fast user interface that gives you the ability to modify the translation form files very smoothly through your computer.
But in order to be able to localize the WordPress template through that program, you must make sure that it contains the following translation template file pot After making sure that that file is inside the template files, open that file using the Poedit program and press the + button until a new translation is created This is shown in the following figure as follows.
Now a large group of languages will appear in front of you in the form of a drop-down list. In the event that you want to localize the WordPress template, you must choose the Arabic language so that the program creates a translation that takes the following name ar.po in addition to the ar.mo file that facilitates the understanding of the translation.
After that, all the text that you must translate will appear in front of you. For example, if your template contains the word Next, you must translate it into Arabic as follows % Next Next % This is just an example, and after you translate all the phrases, you must click on Save until all are saved Changes within the Portable Object Template file.
Note: Take a backup copy of the Portable Object Template file and also the .mo file in a safe place outside the template files, because if the template is updated by the developer, you will need them again, so you must preserve them to avoid re-localizing the template Once again.
Second: adding the WordPress Loco Translate
It is one of the most popular and best WordPress plugins in this field and is relied upon by many website owners because it contains a highly efficient translator through which you can localize the WordPress template as well as all WordPress plugins in a very smooth and simple way through the WordPress control panel only.
This add-on has many great features and features. For example, if your site template does not contain a Portable Object Template file, the texts will be translated easily, though, as it automatically creates that file and adds it to your site template files. e-mail so that you can translate the template to any language you want with ease.
Although the quality of the file is not the same as the quality of the file that the WordPress template programmer does, it fulfills the purpose and gives you the opportunity to localize the WordPress template very smoothly and translate all phrases and texts into Arabic or any other language, and here is another way that enables you to localize the WordPress template from within the basic files for your WordPress theme.
– How to localize the WordPress template through the template’s source files, in steps
You can localize the WordPress template in another way, which is to open the php source files through the template file editor and manually translate the texts and phrases inside those files without the need for tools to help you in that, but make sure that you have taken a backup copy of your site files to restore them at a later time In the event that a problem occurs, you can use the Updraft Plus WordPress plugin to implement this step.
But if you update your template, it will lose all the phrases that you have translated and it will return to what it was in the beginning, in addition to that, if you want to have a multilingual website, you will not be able to do that, only you will have a website in one language Only Arabic, English or any other language.
Support RTL direction from right to left
In this part of the explanation, we will learn together how to change the direction of your website from left to right to right to left and make your site support the RTL system, and it is one of the important steps if you want to localize the WordPress template.
As we knew at the beginning, it is likely that you will find your WordPress template that supports the RTL feature, because most programmers and developers at the present time care about this feature a lot, but in the event that you encounter some difficulty and do not find it supporting the RTL system, you will have to change some code so that it supports the RTL system from right to left.
How to localize a WordPress template
Make RTL write
How to check if a WordPress theme is RTL compatible?
In the event that you want to verify that your website supports the right-to-left RTL feature, you must read the specifications of the template on the website of the company that developed the template in order to be able to localize the WordPress template and make the template work in Arabic instead of English.
Unfortunately, it may not be a sufficient step to ensure that your website template supports the Arabic language. Therefore, you must make sure that the template files contain an additional css file to support the writing direction in the Arabic language. You will often find the file taking the following addresses: rtl.css or style-rtl.css If you find these files included in your website, you will definitely find that it supports RTL.
After that, download and activate the RTL Tester plugin on your WordPress site, so that you can test whether the feature works correctly or not? Once installed, you will find a shortcut for it that takes the name of the plugin in the top menu or side menu within the WordPress control panel, and once you click on it, all elements of your site will be converted to the Right-to-Left system, giving you the opportunity to fully test the feature and make sure that the template is suitable.
How to make a WordPress theme fully support the Right-to-Left feature
If you test the compatibility of your website with the right-to-left RTL property, and you do not find that it supports this feature and that it works incorrectly with the Arabic language, you can create another CSS file that supports the Right-to-Left property, and we learn as follows how to implement this process within the lines Upcoming:-
The first step is to use some tools that will help you automatically convert all your WordPress theme layout files to style-rtl.css.
And create a new file from the RTL-supportive CSS template formats file and your site works from right to left in an elegant and coordinated manner, and there are many, many tools that help you implement this step correctly and very easily without much effort, and here are the best tools (CSS RTL generator) that Helps you make a right-to-left RTL-compliant site scheme:
CSS Janus tool : It is a very professional and smooth tool that gives you the opportunity to convert the entire layout of your site's directions and create a new styles.css file that supports the Right-to-Left property. You can perform this step through the right panel inside the input tool, then press the send button, and thus it will You can get a new modified CSS code, and you will find it inside the output section, and you will find the code that supports the RTL property.
What you have to do is copy the modified code and then paste it into a new CSS file and name it (style-rtl.css) and save it alongside the styles.css file in the template.
RTL CSS tool : This tool provides the same service as the tool that we got to know together, which is to change the format of css codes to support the Right-to-Left format, but this tool has a set of additional great features and characteristics, including the feature of clarifying the changes that have been modified and reformatted. With this feature, by pressing the Compre button located at the top, which distinguishes the changes that have been implemented in different colors.
Change RTL direction manually via rtl.css template layout file
This method is very good and brilliant results are achieved, but it takes a lot of time and effort, but you have to be aware of the CSS web design language and produce through this method very clean, formatted and light code instead of doing a complete conversion of the style.css file.
To implement this method, you must go to your site's files and create a new file with the following name (rtl.css). This file makes your site partially ignore the styles.css file when needed, and it displays all elements and phrases from right to left. Here are the most important steps that you must follow To create this file:
1. First, create a new file and name it rtl.css, then save it in the style.css folder, then add the following code at the beginning of that file, and it will help you a lot in solving the problem of making elements from right to left.
body {
direction: rtl;
unicode-bidi: embed;
}
2. Then check all the lines in your website's style.css file and copy all the lines of code that contain the horizontal orientation property for example ( float , position or text-align ), and paste it into the new file named rtl.css And then change the value of the codes to the opposite, i.e. left becomes right, right becomes left, and so on. You must also check the margin and padding values and change their value to the opposite to be compatible with the Arabic language.
3. In addition, you will need to change some of the other code values in your website and modify them in order to make them more consistent with the Arabic language, and in the event that you find some code that contradicts the RTL system, use a css code checking tool such as the (Inspect Element) tool inside a browser web to identify problems within css codes and work to solve them.
4. You must make sure that the images within your website work correctly. Examples of these images are icons, images of arrows that point to the left or the right, etc. If you find these images on your site, you must change them in the rtl.css file.
5. Here, the site has been made compatible with the RTL feature, but one thing remains, which is to choose the appropriate fonts for the Right-to-Left system from right to left, and you can use Google fonts suitable for the Arabic language.
Once the previous steps are completed, it will produce a very small and formatted file smaller than the styles.css file generated by the tools, but this method will require you a lot of time and effort, but you will get a clean and elegant file, and template updates will not make any difference with you and will not affect your website.
Conclusion:
Now, together, we have learned how to localize the WordPress template in several different ways, in addition to making the writing direction from right to left, adjusting all css codes and formatting them, and the method of translating all phrases and texts into Arabic, in addition to the best tools and additions that will help you easily localize the WordPress template. Absolutely and completely free. In the event that you encounter a problem or want to inquire about something, you can contact us through the comments section.
Comments
Post a Comment