{"id":811172,"date":"2016-02-12T09:44:38","date_gmt":"2016-02-12T09:44:38","guid":{"rendered":"https:\/\/wpml.org\/?p=811172"},"modified":"2016-06-03T12:50:14","modified_gmt":"2016-06-03T12:50:14","slug":"how-to-translate-a-string-coming-from-wptouch-themes-and-extensions","status":"publish","type":"post","link":"https:\/\/wpml.org\/it\/tutorials\/2016\/02\/how-to-translate-a-string-coming-from-wptouch-themes-and-extensions\/","title":{"rendered":"How to Translate Strings Coming from WPTouch Themes and Extensions"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p><a href=\"http:\/\/www.wptouch.com\/\">WPTouch<\/a> is a popular WordPress plugin that allows you to display your site\u2019s content on mobile devices. It can send mobile-optimized content, pictures, scripts, and CSS code instead of \u2018normal\u2019 ones. This speeds things up considerably. It also allows your iOS visitors to save your website like an app.<\/p>\n<p>WPTouch works great with WPML. In this tutorial, we will explain how to translate text that comes with WPTouch themes and extensions.<\/p>\n<h2>What You Will Need:<\/h2>\n<ul>\n<li>A recent version of <a href=\"https:\/\/wpml.org\/purchase\/\">WPML<\/a>, including the String Translation and Translation Management add-ons<\/li>\n<li>The <a href=\"http:\/\/www.wptouch.com\/pricing\/\">WPTouch plugin<\/a><\/li>\n<li>One of WPtouch\u2019s extensions (We use the <a href=\"http:\/\/www.wptouch.com\/themes\/\">Mobilestore theme<\/a> in this tutorial)<\/li>\n<\/ul>\n<h2>Essential Resources:<\/h2>\n<ul>\n<li>WPML\u2019s <a href=\"https:\/\/wpml.org\/documentation\/getting-started-guide\/\">Getting Started Guide<\/a> will help you in setting up WPML in only a few minutes. You will want to refer to some of its subtopics later, such as <a href=\"\/?page_id=2717\">Theme and Plugin Localization<\/a> and <a href=\"https:\/\/wpml.org\/documentation\/getting-started-guide\/string-translation\/\">String Translation<\/a>. We recommend you keep the Getting Started Guide open while following this tutorial.<\/li>\n<li><a href=\"https:\/\/support.wptouch.com\/support\/home\">WP Touch documentation<\/a> has an excellent collection of tutorials that can help you get started.<\/li>\n<\/ul>\n<h2>Translating Strings Coming from WPTouch Themes and Extensions<\/h2>\n<p>WPTouch allows one-click downloading and installation of additional themes and extensions. The extensions are saved in wp-content\/wptouch-data. As you can see, this path is outside the default plugin directory. WPML String Translation scans \u00a0everything inside the themes directory (wp-content\/themes) and the plugins directory (wp-content\/plugins). We will create and import .po files into the String Translation table so you can translate these strings with WPML.<\/p>\n<p>First, make sure you enabled theme and plugins localization in WPML, You can do that by going to WPML &gt; Theme and plugin localization, then choosing \u201cTranslate the theme and plugins using WPML\u2019s String Translation.\u201d<\/p>\n<p><a href=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/image1.png\"><img decoding=\"async\" class=\"aligncenter wp-image-811197 \" src=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/image1.png\" alt=\"Translate the theme and plugins using WPML\u2019s String Translation\" width=\"601\" height=\"275\" srcset=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/image1.png 752w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/image1-150x69.png 150w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/image1-300x137.png 300w\" sizes=\"(max-width: 601px) 100vw, 601px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>The Mobilestore theme, which is a WPTouch extension, does not come with a .po file, so we must create one.<\/p>\n<p>Obtain zipped theme files from your site after it is downloaded using the WPTouch installer. This can be done by following these steps:<\/p>\n<ol>\n<li>Go to the WordPress directory.<\/li>\n<li>Then, go to wp-content\/wptouch-data\/themes.<\/li>\n<li>Locate the theme folder. In our case, it will be the \u201cmobilestore&#8221; folder.<\/li>\n<li>Download the mobilestore files and compress them with a .zip extension.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/create-.po-file1.png\"><img decoding=\"async\" class=\"aligncenter wp-image-811219\" src=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/create-.po-file1-300x271.png\" alt=\"create .po file1\" width=\"372\" height=\"336\" srcset=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/create-.po-file1-300x271.png 300w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/create-.po-file1-150x136.png 150w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/create-.po-file1.png 763w\" sizes=\"(max-width: 372px) 100vw, 372px\" \/><\/a><\/p>\n<p>The second step is to create our .po file:<\/p>\n<ol>\n<li>After getting the zipped theme file, you can extract strings and export .po files using various tools. ICL PHP Scanner will do the trick. <a href=\"http:\/\/www.icanlocalize.com\/tools\/php_scanner\">http:\/\/www.icanlocalize.com\/tools\/php_scanner<\/a><\/li>\n<li>Upload the zipped file by clicking on the \u201cBrowse\u2026\u201d button next to \u201cPHP file to process (required)\u201d:.<\/li>\n<li>Click on the \u201dCreate .po file &gt;&gt;\u201d button. This creates the wptouch-pro.po<\/li>\n<\/ol>\n<p><a href=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/create-.po-file2.png\"><img decoding=\"async\" class=\"aligncenter wp-image-811226\" src=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/create-.po-file2-300x199.png\" alt=\"create .po file2\" width=\"436\" height=\"289\" srcset=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/create-.po-file2-300x199.png 300w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/create-.po-file2-150x100.png 150w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/create-.po-file2-768x510.png 768w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/create-.po-file2.png 915w\" sizes=\"(max-width: 436px) 100vw, 436px\" \/><\/a><\/p>\n<p>Once you have the wptouch-pro.po file, upload it to your site using the WPML String Translation screen. Remember to assign the correct context for imported strings (if the \u00a0wptouch-pro context is missing, create a new context with that name).<\/p>\n<ol>\n<li>Go to WPML &gt;&gt; String Translation &gt;&gt; Import \/ export .po section.<\/li>\n<li>Next to \u201c.po file\u201d:, click the \u201dBrowse\u2026\u201d button and upload the wptouch-pro.po<\/li>\n<li>Choose \u201cAlso create translations according to the .po file.\u201d<\/li>\n<li>Choose the string domain from the drop down menu next to \u201cSelect what the strings are for:\u201d Note that you can create a new domain by clicking on \u201cnew\u201d then typing the domain name (wptouch-pro).<\/li>\n<li>Click on the \u201cSubmit\u201d button<\/li>\n<\/ol>\n<p><a href=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-.po-file-to-string-translation.png\"><img decoding=\"async\" class=\"aligncenter wp-image-811229\" src=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-.po-file-to-string-translation-300x151.png\" alt=\"add .po file to string translation\" width=\"485\" height=\"244\" srcset=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-.po-file-to-string-translation-300x151.png 300w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-.po-file-to-string-translation-150x75.png 150w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-.po-file-to-string-translation-768x386.png 768w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-.po-file-to-string-translation-1024x515.png 1024w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-.po-file-to-string-translation.png 1213w\" sizes=\"(max-width: 485px) 100vw, 485px\" \/><\/a><\/p>\n<p>After the upload is finished, you will be redirected to the string selection screen. Select all the strings you want to translate, then click on \u201cAdd selected strings.\u201d<\/p>\n<p><a href=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-selected-strings.png\"><img decoding=\"async\" class=\"aligncenter wp-image-811231\" src=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-selected-strings-300x137.png\" alt=\"add selected strings\" width=\"495\" height=\"226\" srcset=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-selected-strings-300x137.png 300w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-selected-strings-150x69.png 150w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-selected-strings-768x351.png 768w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-selected-strings-1024x468.png 1024w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/add-selected-strings.png 1065w\" sizes=\"(max-width: 495px) 100vw, 495px\" \/><\/a><\/p>\n<p>After importing the strings, registered strings which are ready to be translated can be found on the WPML &gt;&gt; String Translation screen. Note that you can find all the strings under the wptouch-pro domain.<\/p>\n<p><a href=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/string-translation.png\"><img decoding=\"async\" class=\"aligncenter wp-image-811240\" src=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/string-translation-300x156.png\" alt=\"string translation\" width=\"486\" height=\"253\" srcset=\"https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/string-translation-300x156.png 300w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/string-translation-150x78.png 150w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/string-translation-768x400.png 768w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/string-translation-1024x534.png 1024w, https:\/\/wpml.org\/wp-content\/uploads\/2016\/02\/string-translation.png 1076w\" sizes=\"(max-width: 486px) 100vw, 486px\" \/><\/a><\/p>\n<h2>Conclusion<\/h2>\n<p>Creating .po files and importing them into WPML String Translation tables will register the strings to be translated on the string translation screen. This can only be done when the installed plugin, theme or extension has its own directory (not under the default directory).<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction WPTouch is a popular WordPress plugin that allows you to display your site\u2019s content on mobile devices. It can send mobile-optimized content, pictures, scripts, and CSS code instead of \u2018normal\u2019 ones. This speeds things up considerably. It also allows your iOS visitors to save your website like an app. WPTouch works great with WPML. [&hellip;]<\/p>\n","protected":false},"author":76577,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"ep_exclude_from_search":false,"footnotes":""},"categories":[1371,8],"tags":[],"class_list":["post-811172","post","type-post","status-publish","format-standard","hentry","category-compatibility","category-tutorials"],"_links":{"self":[{"href":"https:\/\/wpml.org\/it\/wp-json\/wp\/v2\/posts\/811172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpml.org\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpml.org\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpml.org\/it\/wp-json\/wp\/v2\/users\/76577"}],"replies":[{"embeddable":true,"href":"https:\/\/wpml.org\/it\/wp-json\/wp\/v2\/comments?post=811172"}],"version-history":[{"count":8,"href":"https:\/\/wpml.org\/it\/wp-json\/wp\/v2\/posts\/811172\/revisions"}],"predecessor-version":[{"id":896895,"href":"https:\/\/wpml.org\/it\/wp-json\/wp\/v2\/posts\/811172\/revisions\/896895"}],"wp:attachment":[{"href":"https:\/\/wpml.org\/it\/wp-json\/wp\/v2\/media?parent=811172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpml.org\/it\/wp-json\/wp\/v2\/categories?post=811172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpml.org\/it\/wp-json\/wp\/v2\/tags?post=811172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}