{"id":3633,"date":"2015-05-05T09:01:47","date_gmt":"2015-05-05T09:01:47","guid":{"rendered":"https:\/\/wpopal.com\/?p=3633"},"modified":"2015-05-05T09:01:47","modified_gmt":"2015-05-05T09:01:47","slug":"how-to-translate-wordpress-plugin-and-theme","status":"publish","type":"post","link":"http:\/\/dev.wpopal.com\/wpopal\/how-to-translate-wordpress-plugin-and-theme\/","title":{"rendered":"How to translate WordPress plugin and theme"},"content":{"rendered":"<p>In the process of supporting customers, <a class=\"blue\" href=\"https:\/\/wpopal.com\/\" rel=\"nofollow noopener\" target=\"_blank\">Opal WordPress<\/a>\u00a0usually receives\u00a0many emails about translation. Through searching, we see that translation is one of the most highly requested topics on forums, community. In fact, not all wordpress users live in US and almost they speak English as a second language, sometimes they meet many issues about languages while supporting &amp; using. They wish it will have a tool to translate a wordpress phugin and theme that brings convenience for their usage as a native language. By reading and doing research many documents, blogs and article of other authors, Opal WordPress is very happy to share a blog of\u00a0<strong>How to translate WordPress plugin and theme\u00a0<\/strong>. Hoping it will be useful and essential for \u00a0readers\u00a0to apply this tool during the process of usage perfectly and smoothly.<br \/>\nWordPress uses the GNU gettext localization framework for translation. There are three types of files used in the framework:<br \/>\n<strong>POT (Portable Object Template) files:<\/strong>\u00a0The first step in the translation process is using a program to search through the WordPress source code to pick out text passed into a <em>__()<\/em>or<em>\u00a0__e()<\/em> function, generating a POT file. This file will contain all the text available for translation.<br \/>\n<strong>PO (Portable Object) files:\u00a0<\/strong>The second step involves translating the text in a POT file into the target language, saving both English and translator messages in a PO file.<br \/>\n<strong>MO (Machine Object) files: <\/strong>In the last step, the PO file is converted into a machine readable format.<\/p>\n<h3>Translating Using Poedit<\/h3>\n<p>First, surely you installed PoEdit into your computer. It\u2019s available and you can free download it at <a title=\"PoEdit\" href=\"http:\/\/poedit.net\/\" target=\"_blank\" rel=\"nofollow external noopener noreferrer\">http:\/\/poedit.net\/<\/a>, used for all operating systems such as Windows, Linux, MacOS.<\/p>\n<h4># 1. Using file .pot<\/h4>\n<p>File .pot is a file containing words in this code you can translate. After you have installed competely, you can open it and select <em>File &gt; New Catalog from POT file<\/em>. Then select the .pot file from the theme you wish to translate which you can find in the \/includes\/lang\/ or \/languages\/ folder of your theme.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/wpopal.com\/wp-content\/uploads\/2015\/05\/tudich-poedit-1.jpg\" rel=\"nofollow noopener\" target=\"_blank\"><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-3639\" src=\"https:\/\/wpopal.com\/wp-content\/uploads\/2015\/05\/tudich-poedit-1.jpg\" alt=\"Poedit\" width=\"580\" height=\"299\" title=\"\"><\/a><\/p>\n<p>For example, if you want to translate wordpress theme into Vietnamese please choose file .pot in the category of theme\/plugin, then select Vietnamese (vietnam). Besides, there are many language codes\u00a0such as en_ES.po, nl_NL.po, de_De.po, zh_CN.po&#8230;<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/wpopal.com\/wp-content\/uploads\/2015\/05\/vietnamese.jpg\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" class=\"alignnone size-full wp-image-3640\" src=\"https:\/\/wpopal.com\/wp-content\/uploads\/2015\/05\/vietnamese.jpg\" alt=\"vietnamese\" width=\"490\" height=\"204\" title=\"\"><\/a><\/p>\n<p>When choice is Vietnamese, it will automatically name your new file &#8221; vi_VN.po &#8221; but if you want to use it well with WordPress in Vietnamese language, please enter into <strong>File -&gt;Save As<\/strong> and name &#8221; vi.po&#8221;, then open file vi.po to translate.<br \/>\nWhen saving file vi.po by PoEdit, it will give you a file <strong>&#8220;vi.mo&#8221;<\/strong> &#8211; this is file that WordPress will read. Therefore, take notice that when translating please open file vi.po, finish and remember to Save. Like so, file vi.mo will be updated.<br \/>\nThen translate completely, surely you installed Vietnamese language for WordPress or remove WordPress into another language. Finally you go to the category of\u00a0<strong>\/wp-content\/languages\/<\/strong> and go to the item of themes or plugins copy file vi.mo and change it into <strong>product name -vi.mo\u00a0<\/strong>.<br \/>\nFor example, plugin Askimet will have the category of\u00a0\/wp-content\/plugins\/askimet\/ so we name its file of this plugin <strong>&#8220;wp-askimet-vi.mo&#8221;<\/strong> in the category of <strong>\/wp-content\/languages\/plugins\/.<\/strong><br \/>\nFollow this video of Askimet plugin<br \/>\n<div style=\"width: 980px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3633-1\" width=\"980\" height=\"686\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/wpopal.com\/wp-content\/uploads\/2015\/05\/Askimet-vi.mo_.mp4?_=1\" \/><a href=\"https:\/\/wpopal.com\/wp-content\/uploads\/2015\/05\/Askimet-vi.mo_.mp4\" rel=\"nofollow noopener\" target=\"_blank\">https:\/\/wpopal.com\/wp-content\/uploads\/2015\/05\/Askimet-vi.mo_.mp4<\/a><\/video><\/div><\/p>\n<h4># 2. Using file .po<\/h4>\n<p>If the products you need to translate without having file .pot, you can reuse file \u00a0.pot they provide available in the source then do as the way you perform above. This means that you change file name into product name -vi.po then translate and copy into the category of <strong>\/wp-content\/languages<\/strong>.<\/p>\n<h3>Setting Up Your Translated Theme in WordPress<\/h3>\n<p>As English is the default language for WordPress, you will need to play with a little code to force WordPress to use your translated files.<br \/>\nIn order to do this, you will need to FTP into your WordPress install and open up the wp_config file and add this line of code:<\/p>\n<div id=\"fvch-codeblock-0\" class=\"fvch-codeblock\">\n<table>\n<tbody>\n<tr>\n<td class=\"fvch-line-numbers\">\n<pre>1<\/pre>\n<\/td>\n<td class=\"fvch-code\">\n<pre id=\"fvch-code-0\">define ('WPLANG', 'de_De');<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>This line specifies German\u00a0for Germany, so you\u2019ll need to replace de_De\u00a0with your language and country code.<br \/>\nAdding this line tells WordPress you want to use translation files for German. Since you\u2019ve translated only your theme and not your backend, your site will display in German\u00a0but your WordPress admin area will continue to display in English.<br \/>\n<strong>Morover, we will give\u00a0some notes when translating<\/strong><br \/>\n<strong><em>Don\u2019t translate literally, translate organically<\/em>:\u00a0<\/strong>Languages have different structures, rhythms, tones, and inflections. Translated text don\u2019t need to be structured the same way as the English ones: take the ideas that are presented and come up with a message that expresses the same thing in a natural way for the target language.<br \/>\n<strong><em>Try to keep the same level of formality (or informality)<\/em>:<\/strong>Try to accomplish the equivalent in the target language, within your cultural context.<br \/>\n<em><strong>Don\u2019t use slang or audience-specific terms:<\/strong>\u00a0<\/em>Stay away from colloquialisms and to stick with what you think a new blogger would understand.<br \/>\n<strong><em>Read other software\u2019s localization in your language<\/em>:\u00a0<\/strong>If you get stuck or need direction, try reading through the translations of other popular software to get a feel for how they have tackled translations.<br \/>\nAbove this is the whole of\u00a0<strong>How to translate WordPress plugin and theme<\/strong> Opal WordPress wants to share with you. By reading and searching other good writings, surely our article has errors hoping you will read and take note new things helping us more perfect. Through it, we will improve the quality of blog and then publish better articles. Please follow our social media (<a class=\"blue\" href=\"https:\/\/www.facebook.com\/opalwordpress\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">Facebook<\/a>, <a class=\"blue\" href=\"https:\/\/twitter.com\/?lang=en\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">Twitter<\/a>, <a class=\"blue\" href=\"https:\/\/www.linkedin.com\/home?trk=nav_responsive_tab_home\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">Linkedin<\/a>, <a class=\"blue\" href=\"https:\/\/www.youtube.com\/user\/WPOpalTheme\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">Youtube,<\/a> <a class=\"blue\" href=\"https:\/\/www.pinterest.com\/cunconvp192\/\" target=\"_blank\" rel=\"noopener noreferrer nofollow\">Pinterest<\/a>) to get latest information!<br \/>\nThanks so much !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the process of supporting customers, Opal WordPress\u00a0usually receives\u00a0many emails about translation. Through searching, we see that translation is one of the most highly requested topics on forums, community. In fact, not all wordpress users live in US and almost they speak English as a second language, sometimes they meet many issues about languages while [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":30913,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[27],"tags":[],"class_list":["post-3633","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"_links":{"self":[{"href":"http:\/\/dev.wpopal.com\/wpopal\/wp-json\/wp\/v2\/posts\/3633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/dev.wpopal.com\/wpopal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/dev.wpopal.com\/wpopal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/dev.wpopal.com\/wpopal\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"http:\/\/dev.wpopal.com\/wpopal\/wp-json\/wp\/v2\/comments?post=3633"}],"version-history":[{"count":0,"href":"http:\/\/dev.wpopal.com\/wpopal\/wp-json\/wp\/v2\/posts\/3633\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/dev.wpopal.com\/wpopal\/wp-json\/wp\/v2\/media\/30913"}],"wp:attachment":[{"href":"http:\/\/dev.wpopal.com\/wpopal\/wp-json\/wp\/v2\/media?parent=3633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/dev.wpopal.com\/wpopal\/wp-json\/wp\/v2\/categories?post=3633"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/dev.wpopal.com\/wpopal\/wp-json\/wp\/v2\/tags?post=3633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}