<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WPML &#187; Tutorials</title>
	<atom:link href="http://wpml.org/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpml.org</link>
	<description>The Plugin for Building Multilingual WordPress Sites</description>
	<lastBuildDate>Wed, 01 Feb 2012 18:40:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Can Your Site Run Faster?</title>
		<link>http://wpml.org/2012/01/can-your-site-run-faster/</link>
		<comments>http://wpml.org/2012/01/can-your-site-run-faster/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 13:18:31 +0000</pubDate>
		<dc:creator>Amir</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wpml.org/?p=9127</guid>
		<description><![CDATA[Everyone loves faster sites. Speed is important to human visitors as well as search engines and it&#8217;s certainly worth spending time on, to optimize. Here are a few tips that can make your multilingual site faster. Speed and performance optimization are an endless tunnel. No matter where you are, there&#8217;s always room for improvement. There [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Everyone loves faster sites. Speed is important to human visitors as well as search engines and it&#8217;s certainly worth spending time on, to optimize. Here are a few tips that can make your multilingual site faster.</strong></p>
<p>Speed and performance optimization are an endless tunnel. No matter where you are, there&#8217;s always room for improvement. There are the simple and trivial optimization steps and the more advanced ones. The results you&#8217;ll get are very dependent on the amount of effort you&#8217;re willing to put in.</p>
<p>First, it&#8217;s important to understand the basics.</p>
<p>When a visitors go to your site, they need to receive a response, in the form of a page.</p>
<h2>Page Caching</h2>
<p>Your first line of defense is page caching. Page caching will return the response from the disk, or from memory without asking WordPress to prepare it. Obviously, using page caching is the one most important step towards a fast site.</p>
<p>In our sites, we use either <strong>WP Super Cache</strong> or <strong>W3TC</strong>.</p>
<ul>
<li><strong><a href="http://wordpress.org/extend/plugins/wp-super-cache/">WP Super Cache</a> &#8211; easier to configure and harder to go wrong</strong>. We use that on low-traffic sites, where we just need page caching to avoid WordPress from processing each and every request.</li>
<li><strong><a href="http://wordpress.org/extend/plugins/w3-total-cache/">W3TC</a> &#8211; a complete package for speed optimization, requiring reasonable understanding of what you&#8217;re doing</strong>. When used correctly, W3TC can perform every optimization possible for your site. However, you need to understand what you&#8217;re doing and it&#8217;s possible to crash your site when you don&#8217;t. We use W3TC on <a href="http://wpml.org">wpml.org</a> and <a href="http://wp-types.com">wp-types.com</a>, which are relatively high-traffic sites and speed is critical. We use every single feature in W3TC to squeeze out all the performance we can.</li>
</ul>
<p>If you&#8217;re interested in more details, check out my older, but still relevant. post about <a href="http://wpml.org/2011/03/wpml-with-w3tc/">WPML and W3TC</a>.</p>
<h2>CDN, Minify, Object Caching and APC</h2>
<p>Besides the basic page caching, there are a number of techniques to further improve your site&#8217;s performance. Here are the popular ones:</p>
<p><strong>CDN</strong> (<strong>C</strong>ontent <strong>D</strong>elivery <strong>N</strong>etwork): Your static files will be hosted on other servers, closer to visitors. Instead of hitting your server to get static content, this content will go directly from the CDN. There are different CDN providers, such as <a href="http://www.maxcdn.com/">MaxCDN</a> and <em>Amazon</em>. On our sites, we use Amazon <a href="http://aws.amazon.com/s3/">S3</a> + <a href="http://aws.amazon.com/cloudfront/">CloudFront</a>.</p>
<p><strong>Minify</strong>: Pack static CSS and Javascript files into fewer files. This way, instead of loading dozens of tiny CSS and JS files, visitors will load fewer and larger files. If you also use a CDN, this doesn&#8217;t have an effect on your server, but can greatly enhance the browsing experience by first-time visitors.</p>
<p><strong>Object Cache</strong>: Stores data units that take long to compute. You can read more about that in <a href="http://codex.wordpress.org/Class_Reference/WP_Object_Cache">WordPress codex</a>.</p>
<p><strong>PHP Opcode Cache</strong>: Pre-compiles PHP code, so that it doesn&#8217;t have to be interpreted from scratch for every page load.</p>
<p>There are plugins that implement each of these operations. W3TC implements them all too.</p>
<h2>Specific Optimization for Your Site</h2>
<p>Page caching, CDN and Object Caching will give your site the initial speed boost. They prevent WordPress from executing, or from executing from scratch, for every single request. However, even with all the caching in the world, sometimes, WordPress does need to produce content. Then, if it takes 40 seconds for a page to compute, it&#8217;s not going to fly.</p>
<p>To optimize the performance of page-rendering by WordPress, you must first understand where most of the time is spent.</p>
<p>I recommend to start with a plugin called <a href="http://wordpress.org/extend/plugins/debug-queries/">Debug Queries</a>. Enable it and look at your site&#8217;s footer. You&#8217;ll see exactly how much time PHP processing and database processing took. You&#8217;ll also get a breakdown of the individual queries that make up each page.</p>
<div id="attachment_9135" class="wp-caption alignnone" style="width: 310px"><a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2012/01/debug-queries-output.png"><img class="size-medium wp-image-9135" title="debug-queries-output" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2012/01/debug-queries-output-300x200.png" alt="" width="300" height="200" /></a><p class="wp-caption-text">Debug Queries output</p></div>
<p>I cannot stress enough how important doing this is for your site. Without checking what your site does now, there&#8217;s no way to tell where there&#8217;s waste and what needs improving.</p>
<p>You should look for things like:</p>
<ul>
<li>The same query running over and over again.</li>
<li>A series of queries loading individual items instead of a single query loading the entire array</li>
<li>Joins on huge tables, which take long to perform</li>
<li>Queries that search by columns that have no index, or text searches</li>
</ul>
<p>All these things will surely slow your site and can be avoided. Many times, you&#8217;ll see them happening in conjunction, with a single solution to fix a few problems together.</p>
<p>Often, in order to really fix these issues, someone is going to have to work hard on the site&#8217;s coding. In other cases, different usage of widgets or theme options can greatly reduce the database load and increase the site&#8217;s speed.</p>
<h2>Using WPML Better</h2>
<p>WPML has several features that help you manage your site, but also require database resources to run.</p>
<h3>String Translation Features</h3>
<p>WPML&#8217;s String Translation module is fairly optimized and should not slow your site, just as long as you know what you&#8217;re telling it to do.</p>
<p>It already comes with a caching engine, which will load entire contexts in a single query. When  a plugin, or your theme, loads translation using a GetText call, or directly using WPML&#8217;s <em>icl_t</em> function, WPML will load all the translations for that context. This means that other strings that belong to that plugin or theme are already in memory. This is similar to the way GNU GetText operates.</p>
<p>The String Translation module includes several features which help you locate and register strings for translation. To work, they require the database. These features are not intended for normal production usage and only affect performance for logged-in users.</p>
<p>They are explained in the <a href="http://wpml.org/faq/why-string-translation-appears-to-slow-down-sites/">String Translation performance FAQ</a>.</p>
<h3>Auto ID-Adjust</h3>
<p>WPML creates different posts for different languages. Many themes refer to specific posts and want to load them from the database. They don&#8217;t know that you&#8217;re using WPML, so they don&#8217;t care about the same page appearing on different posts for different languages.</p>
<p>To allow you to use your themes, without any PHP edits, WPML include a handy feature that automatically converts IDs to those in the current language. If your theme attempts to load a page in English, but the site is now displaying in French, WPML will deliver the French page instead of the English page.</p>
<p>To do this, WPML needs to query the database, look for the French translation and deliver this instead. This operation requires database access.</p>
<p>You can control how this works by enabling and disabling the feature called <strong>Adjust IDs for multilingual functionality</strong>, under WPML-&gt;Languages.</p>
<div id="attachment_9141" class="wp-caption alignnone" style="width: 310px"><a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2012/01/auto-id-adjust.png"><img class="size-medium wp-image-9141" title="auto-id-adjust" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2012/01/auto-id-adjust-300x107.png" alt="" width="300" height="107" /></a><p class="wp-caption-text">Auto ID adjustment control</p></div>
<p>For smaller and less busy sites, it might not be worth the trouble. However, for busy and performance-critical sites, we recommend to disable this option and do the ID adjustments yourself.</p>
<p>Use WPML&#8217;s <a href="http://wpml.org/documentation/support/creating-multilingual-wordpress-themes/language-dependent-ids/">icl_object_id</a> function to do this manually, thereby saving many accesses on places where the ID conversion is not really required (but WPML cannot tell that). On this site, we handle ID conversion manually. It&#8217;s only needed in a handful of places.</p>
<h3>Separate WPML&#8217;s Impact</h3>
<p>While there are many things that you can optimize, which are not all related with WPML, we want to know that we&#8217;ve done our job right.</p>
<p>Grab a copy of your database and <strong>run it locally. Try with and without WPML</strong>.</p>
<p>If you see a huge change when you enable WPML, we want to know about it. By huge, I mean that it might take 70 queries without WPML and 900 queries with it.</p>
<p><strong>You can post about your experience here, or in our <a href="http://forum.wpm.org">technical forum</a> (better). If we need your database dump to reproduce this situation, we&#8217;ll email you to get it privately.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://wpml.org/2012/01/can-your-site-run-faster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding RTL Support for WPML.org Theme</title>
		<link>http://wpml.org/2011/12/adding-rtl-support-for-theme/</link>
		<comments>http://wpml.org/2011/12/adding-rtl-support-for-theme/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 09:39:44 +0000</pubDate>
		<dc:creator>Daniel Dvorkin</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wpml.org/?p=9019</guid>
		<description><![CDATA[A few days ago, we added Hebrew translation for WPML.org. The challenge was less about adding the translations more with making WPML.org theme display it correctly in right-to-left. Daniel (our support manager) wrote this post to explain what he did to add RTL support to our theme. These were the main challenges we faced: Swap [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, we added <a href="http://wpml.org/he/">Hebrew translation for WPML.org</a>. The challenge was less about adding the translations more with making WPML.org theme display it correctly in right-to-left. Daniel (our support manager) wrote this post to explain what he did to add RTL support to our theme.</p>
<p>These were the main challenges we faced:</p>
<ul>
<li>Swap the navigation, footer and other theme elements from left to right</li>
<li>Adjust some fixed-position elements in the home page for proper RTL display</li>
<li>Swap all floating images in posts and pages from left to right and right to left</li>
<li>Display blog posts in the correct direction &#8211; we display both Hebrew or English for untranslated posts</li>
</ul>
<p>To handle all of them, we added an <em>rtl.css</em> file, which loads after the theme&#8217;s CSS. This file overrides attributes for RTL display and makes the required changes for Hebrew display.</p>
<h2>The CSS</h2>
<p>You have 2 options for showing the correct style and layout for your RTL language:</p>
<ol>
<li>Load your standard CSS and <strong>ALSO </strong>load a new CSS with only the specific changes for RTL</li>
<li>Load a new RTL CSS <strong>INSTEAD OF </strong>your standard CSS</li>
</ol>
<p>For this site we went with option 1 and we created a <a href="http://d2salfytceyqoe.cloudfront.net/wp-content/themes/sitepress/rtl.css.gzip">rtl.css</a> file, but you should know that if you prefer option 2, there is a really cool tool from Google called <a href="http://code.google.com/p/cssjanus/">CSSJanus</a>. This tool is a nifty python script that will read your CSS and change (almost all) the necessary values to convert your theme from LTR to RTL.</p>
<p>But as we did our CSS changes manually, here are the usual changes that you&#8217;ll most certainly need:</p>
<ul>
<li>Add <code>direction:rtl;</code> and <code>text-align:right;</code> to the body tag (or your content wrapper)</li>
<li>Change all <code>float:left;</code> to <code>float:right;</code> and the other way around.</li>
<li>Change all <code>margin-left</code> to <code>margin-right</code> and the other way around.</li>
<li>Look for objects with <code>position:absolute;</code> and move accordingly.</li>
<li>Look for objects with exact <code>background-position</code>, and move accordingly.</li>
</ul>
<p>You get the point, but <a href="http://code.google.com/p/cssjanus/source/browse/trunk/cssjanus_test.py">CSSJanus unit test case</a> will give you more cases that you need to check for.</p>
<h2>The HTML</h2>
<p>Be sure that you have the html tag correctly coded:</p>
<pre>&lt;html xmlns="http://www.w3.org/1999/xhtml" &lt;?php language_attributes(); ?&gt;&gt;</pre>
<h2>The PHP</h2>
<p>If you proceed as we did using an extra CSS file, you can use WPML&#8217;s constant ICL_LANGUAGE_CODE to conditionally include that new CSS. In our case, the RTL language is Hebrew, so our conditional inserted just above the &lt;/head&gt; tag in header.php look like this:</p>
<pre>&lt;?php if (ICL_LANGUAGE_CODE == "he"): ?&gt;
&lt;link rel="stylesheet" href="&lt;?php bloginfo('stylesheet_directory'); ?&gt;/rtl.css" type="text/css" media="screen" /&gt;
&lt;?php endif; ?&gt;</pre>
<p>That alone should do it, but we have another trick for you today. In <a href="http://wpml.org/he/%D7%91%D7%9C%D7%95%D7%92/">our hebrew blog</a> we have mixed languages. Some posts are in hebrew, some in english. So we needed a way to style each post in the loop give its language. Here is where the new <code>wpml_get_language_information </code>API function in WPML comes handy. This is how the start of our loop in our blog index looks like now:</p>
<pre>&lt;?php
while (have_posts()) : the_post();
    $lang_info = wpml_get_language_information(get_the_ID());
    $direction = $lang_info["text_direction"] == 1 ? "rtl" : "ltr";
?&gt;
    &lt;div id="post-&lt;?php the_ID(); ?&gt;"&gt;</pre>
<p>So now, each post is wrapped in a DIV with the correct class, which we can style correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpml.org/2011/12/adding-rtl-support-for-theme/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Short Links to WordPress Content</title>
		<link>http://wpml.org/2011/06/short-links-to-wordpress-content/</link>
		<comments>http://wpml.org/2011/06/short-links-to-wordpress-content/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 13:17:53 +0000</pubDate>
		<dc:creator>Amir</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wpml.org/?p=8138</guid>
		<description><![CDATA[We want our visitors to link to us and share our links with others. However, WordPress often generates very long URLs which are difficult to share. I&#8217;ll show you how to produce short and unbreakable URLs. Have a look at this page: http://wpml.org/documentation/getting-started-guide/language-setup/ The URL takes 68 characters. This is the Chinese translation: http://wpml.org/zh-hans/documentation-4/%E5%85%A5%E9%97%A8%E6%8C%87%E5%8D%97/%E8%AF%AD%E8%A8%80%E8%AE%BE%E7%BD%AE/ That&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><strong>We want our visitors to link to us and share our links with others. However, WordPress often generates very long URLs which are difficult to share. I&#8217;ll show you how to produce short and unbreakable URLs.</strong></p>
<p>Have a look at this page:</p>
<p><a href="http://wpml.org/documentation/getting-started-guide/language-setup/">http://wpml.org/documentation/getting-started-guide/language-setup/</a></p>
<p>The URL takes <strong>68 characters</strong>.</p>
<p>This is the Chinese translation:</p>
<p><a href="http://wpml.org/zh-hans/documentation-4/%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97/%e8%af%ad%e8%a8%80%e8%ae%be%e7%bd%ae/">http://wpml.org/zh-hans/documentation-4/%E5%85%A5%E9%97%A8%E6%8C%87%E5%8D%97/%E8%AF%AD%E8%A8%80%E8%AE%BE%E7%BD%AE/</a></p>
<p>That&#8217;s <strong>114 characters</strong>. A bit long for Twitter and will likely break in an email.</p>
<p>Sure, you can use one of many URL shortening services, but do you really need that? Do you really need to proxy your visitors through a different domain for something as simple as this?</p>
<p>Have a look at the bottom of every page in <a href="/">wpml.org</a>. You&#8217;ll see it saying &#8216;short link to this page&#8217;.</p>
<p>The length of these links is around <strong>22 characters</strong>. A bit less than before.</p>
<p>And, when you click on it, you&#8217;ll see the default link to that page. It&#8217;s not something that we invented. This is how WordPress works. Each page has an ID. When you link to that ID, you link to the page. WordPress will redirect visitors to the current permalink, so they see the nice &#8216;SEO friendly&#8217; URLs.</p>
<p>To add to your theme, first, create a function that generates these default links. This function checks on what type of content we are and generates the URL for it.</p>
<p>You can copy this entire code and add it to your site&#8217;s <em>functions.php</em>.</p>
<pre>function wpml_default_link($anchor){
    global $sitepress;
    $qv = false;

    if(is_single()){
        $qv = 'p=' . get_the_ID();
    }elseif(is_page()){
        $qv = 'page_id=' . get_the_ID();
    }elseif(is_tag()){
        $tag = &amp;get_term(intval( get_query_var('tag_id') ), 'post_tag', OBJECT, 'display');
        $qv = 'tag=' . $tag-&gt;slug;
    }elseif(is_category()){
        $qv = 'cat=' . get_query_var('cat');
    }elseif(is_year()){
        $qv = 'year=' . get_query_var('year');
    }elseif(is_month()){
        $qv = 'm=' . get_query_var('year') . sprintf('%02d', get_query_var('monthnum'));
    }elseif(is_day()){
        $qv = 'm=' . get_query_var('year') . sprintf('%02d', get_query_var('monthnum')) . sprintf('%02d', get_query_var('day'));
    }elseif(is_search()){
        $qv = 's=' . get_query_var('s');
    }elseif(is_tax()){
        $qv = get_query_var('taxonomy') . '=' . get_query_var('term');
    }

    if($qv){
        $link = '&lt;a rel="nofollow" href="' . $sitepress-&gt;language_url($sitepress-&gt;get_default_language()) . '?' . $qv . '"&gt;' . $anchor . '&lt;/a&gt;';
    }else{
        $link = '';
    }

    return $link;
}</pre>
<p>Next, edit your theme and call this function.</p>
<p>We added it to <em>footer.php</em>:</p>
<pre>&lt;?php echo(wpml_default_link(__('Short link to this page','wpml-theme'))); ?&gt;</pre>
<p>And, that&#8217;s all. Now, every page gets this neat short link and invites people to share it.</p>
<p>Go ahead, try it for yourself.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpml.org/2011/06/short-links-to-wordpress-content/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating Right-to-Left (RTL) WordPress Sites</title>
		<link>http://wpml.org/2011/06/creating-right-to-left-rtl-wordpress-sites/</link>
		<comments>http://wpml.org/2011/06/creating-right-to-left-rtl-wordpress-sites/#comments</comments>
		<pubDate>Sun, 05 Jun 2011 13:30:11 +0000</pubDate>
		<dc:creator>Amir</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wpml.org/?p=7878</guid>
		<description><![CDATA[Right-to-Left languages pose a special challenge. Luckily, WordPress goes a long way to reduce the pain. We&#8217;ll show you how to create a perfectly functional RTL site, based on the default TwentyTen theme. When you create a multilingual RTL / LTR site, you need to address two issues: Editing / translation Display The first part, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Right-to-Left languages pose a special challenge. Luckily, WordPress goes a long way to reduce the pain. We&#8217;ll show you how to create a perfectly functional RTL site, based on the default TwentyTen theme.</strong></p>
<p>When you create a multilingual RTL / LTR site, you need to address two issues:</p>
<ul>
<li>Editing / translation</li>
<li>Display</li>
</ul>
<p>The first part, to create or translate your site, means working in the WordPress Admin in the right language and in the right direction. If you are translating between LTR and RTL languages, keep in mind that you&#8217;ll need to see mixed-direction content on the same screen.</p>
<p>When displaying the site, your theme needs to handle correct display direction for RTL and LTR languages.</p>
<p>This tutorial will follow our <a href="http://ml-themes.wpml.org/twentyten/">Twenty Ten Multilingual Demo Site</a>, available in English, Spanish and Hebrew (RTL).</p>
<h2>Preparation &#8211; Getting the Core and Theme .mo Files</h2>
<p>WordPress itself and the default theme are fully localized into many languages. We need the most recent version of the localization, so I decided to get it from the localized WordPress builds. You can get them from here:</p>
<ul>
<li><a href="http://es.wordpress.org/">http://es.wordpress.org/</a> &#8211; Spanish</li>
<li><a href="http://he.wordpress.org/">http://he.wordpress.org/</a> &#8211; Hebrew</li>
</ul>
<p>After you download and unzip WordPress, go to <em>wordpress/wp-content/languages</em>. Copy the entire content to your <em>languages</em> directory. Do the same for the theme. The translation files will be in <em>wp-content/themes/twentyten</em> (or the current default theme if you&#8217;re reading this post later).</p>
<p>You should also configure WPML to allow it to translate the theme and plugins.</p>
<h2>Translating</h2>
<p>WPML&#8217;s Translation Management module allows sending jobs to translation and translating using different accounts. It also lets you translate with WPML&#8217;s Translation Editor. When mixed-direction content is involved, this is particularly important, as the Translation Editor automatically adjusts the direction for each field.</p>
<p>If this is new to you, first read about the <a href="http://wpml.org/documentation/translating-your-contents/using-the-translation-editor/">Translation Management module</a>.</p>
<p>This is how it looks like when I translate the <em>Hello World</em> post to Hebrew.</p>
<div id="attachment_7883" class="wp-caption alignnone" style="width: 310px"><a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/06/rtl-editing.png"><img class="size-medium wp-image-7883" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/06/rtl-editing-300x241.png" alt="" width="300" height="241" /></a><p class="wp-caption-text">Right-to-Left Editing</p></div>
<p>You can see that the English texts are aligned to the left, while Hebrew is aligned to the right. I can even use the HTML mode to copy and paste items from English. The HTML mode displays LTR, to allow you to enter tags correctly.</p>
<p>When you translate strings, WPML also displays them in the correct direction. This is how the String Translation screen looks like when I translate the <em>Search</em> widget title.</p>
<div id="attachment_7885" class="wp-caption alignnone" style="width: 310px"><a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/06/rtl-string-translation.png"><img class="size-medium wp-image-7885" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/06/rtl-string-translation-300x180.png" alt="" width="300" height="180" /></a><p class="wp-caption-text">RTL String Translation</p></div>
<p>The Translation Editor and String Translation modules will allow us to translate the site completely. Next, we see how to display it properly in the right direction.</p>
<h2>Displaying the Site in RTL and LTR</h2>
<p>Now that your content is translated, it&#8217;s time to move our attention to the theme.</p>
<p>This little line does most of the magic:</p>
<pre>&lt;html dir="rtl" lang="he-IL"&gt;</pre>
<p>You can see if it you view the source of any Hebrew page. For example, the <a href="http://ml-themes.wpml.org/twentyten/he/">home page</a>.</p>
<p>The <em>dir=&#8221;rtl&#8221;</em> attribute tells the site that the display direction for the entire site is Right to Left. Browsers understand it and will flip everything to right direction.</p>
<p>This single PHP line, from <em>header.php</em>, makes it happen:</p>
<pre>&lt;html &lt;?php language_attributes(); ?&gt;&gt;</pre>
<p>The call to language_attributes inserts the dir and lang attributes. The values come from the core .mo file. If you have the correct .mo files for WordPress, you get the correct values for these attributes.</p>
<p>If your theme&#8217;s HTML and CSS follow &#8216;safe&#8217; practices, this is really all you need. By safe, I mean no absolute positioning or widths. If you must use absolutes, you may consider loading different CSS per language.</p>
<p>You can do this easily using conditional statements that examine the ICL_LANGUAGE_CODE constant (described in <a href="http://wpml.org/documentation/support/wpml-coding-api/">WPML coding API</a>).</p>
<h2>The Results</h2>
<p>Here is how our <a href="http://ml-themes.wpml.org/twentyten/">demo site</a> looks in English, Spanish and Hebrew.</p>
<table>
<tbody>
<tr>
<td width="33%">
<p><div id="attachment_7892" class="wp-caption alignnone" style="width: 160px"><a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/06/twentyten-en.png"><img class="size-thumbnail wp-image-7892" title="twentyten-en" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/06/twentyten-en-150x107.png" alt="" width="150" height="107" /></a><p class="wp-caption-text">English</p></div></td>
<td width="33%">
<p><div id="attachment_7893" class="wp-caption alignnone" style="width: 160px"><a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/06/twentyten-es.png"><img class="size-thumbnail wp-image-7893" title="twentyten-es" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/06/twentyten-es-150x108.png" alt="" width="150" height="108" /></a><p class="wp-caption-text">Spanish</p></div></td>
<td width="33%">
<p><div id="attachment_7894" class="wp-caption alignnone" style="width: 160px"><a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/06/twentyten-he.png"><img class="size-thumbnail wp-image-7894" title="twentyten-he" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/06/twentyten-he-150x107.png" alt="" width="150" height="107" /></a><p class="wp-caption-text">Hebrew</p></div></td>
</tr>
</tbody>
</table>
<p><strong>It&#8217;s not as hard as it seems. Try it and let us know how you&#8217;re doing.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://wpml.org/2011/06/creating-right-to-left-rtl-wordpress-sites/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>How to Build Different Sidebars per Language</title>
		<link>http://wpml.org/2011/06/how-to-build-different-sidebars-per-language/</link>
		<comments>http://wpml.org/2011/06/how-to-build-different-sidebars-per-language/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 10:34:57 +0000</pubDate>
		<dc:creator>Amir</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wpml.org/?p=7758</guid>
		<description><![CDATA[The Admin content-language switcher in WPML 2.3.0 allows creating different sidebars per language using Woo&#8217;s Sidebar Manager. See how it works. The Sidebar Manager in Woo Framework is a great example for using the new Admin content-language switcher in WPML 2.3.0. It lists pages, categories and templates and lets users create special sidebars that display [...]]]></description>
			<content:encoded><![CDATA[<p><strong>The Admin content-language switcher in WPML 2.3.0 allows creating different sidebars per language using Woo&#8217;s Sidebar Manager. See how it works.</strong></p>
<p>The Sidebar Manager in Woo Framework is a great example for using the new Admin content-language switcher in WPML 2.3.0. It lists pages, categories and templates and lets users create special sidebars that display just for them.</p>
<p>Since translations are actually different pages, a sidebar that you create for a page in one language doesn&#8217;t show for its translations. This features gives the ability to create completely different sidebars per language.</p>
<p>You can use it to display different widgets altogether, or the same widgets but with different texts.</p>
<p>This video shows how I&#8217;m using it on our <a href="http://ml-themes.wpml.org/canvas/">demo Canvas site</a>:</p>
<p><object width="500" height="400"><param name="movie" value="http://www.youtube.com/v/2QWi4Q9fVok?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/2QWi4Q9fVok?version=3" type="application/x-shockwave-flash" width="500" height="400" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>I created this tutorial to show how to use the Admin content-language switcher. Many modern themes allow users to choose content for special site elements. These can be your portfolio page, items for a slider and other cool features. The Admin content-language switcher lets you choose the language of content in any Admin screen.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpml.org/2011/06/how-to-build-different-sidebars-per-language/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Howto Display Different Widgets Per Language</title>
		<link>http://wpml.org/2011/03/howto-display-different-widgets-per-language/</link>
		<comments>http://wpml.org/2011/03/howto-display-different-widgets-per-language/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 05:25:14 +0000</pubDate>
		<dc:creator>Amir</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wpml.org/?p=7153</guid>
		<description><![CDATA[WPML lets you translate widget titles and the body of text widgets. Sometimes, it&#8217;s not enough and you want to have completely different widgets for each language. I&#8217;ll show you how to do this using Widget Logic. Widget Logic is a plugin that allows controlling where widgets display using PHP code. You can use it [...]]]></description>
			<content:encoded><![CDATA[<p><strong>WPML lets you translate widget titles and the body of text widgets. Sometimes, it&#8217;s not enough and you want to have completely different widgets for each language. I&#8217;ll show you how to do this using Widget Logic.</strong></p>
<p><a href="http://wordpress.org/extend/plugins/widget-logic/">Widget Logic</a><a></a> is a plugin that allows controlling where widgets display using PHP code. You can use it to specify where widgets are allowed, including which languages they will display in.</p>
<p>For example, supposing that I want to have different feeds in the widget area. There are different ways to do this, but I&#8217;ll show how it can be done using Widget Logic and language conditions.</p>
<p>Before we begin, download and activate Widget Logic:<br />
<a href="http://wordpress.org/extend/plugins/widget-logic/">http://wordpress.org/extend/plugins/widget-logic/</a></p>
<h2>Add multiple copies of the widget to the Widget Area</h2>
<p>Each of these widgets will be active in only one language, so we need as many copies as the number of languages we have.</p>
<p>The order of these copies doesn&#8217;t matter, as only one will be active at any time.</p>
<div id="attachment_7155" class="wp-caption alignnone" style="width: 307px"><img class="size-full wp-image-7155" title="two-rss-widgets" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/two-rss-widgets.png" alt="" width="297" height="205" /><p class="wp-caption-text">Two RSS widgets, one per language</p></div>
<h2>Add language conditions per widgets</h2>
<p>Click to edit each of these widgets and add the language conditions to the Widget Logic field.</p>
<div id="attachment_7156" class="wp-caption alignnone" style="width: 443px"><img class="size-full wp-image-7156" title="wpml-language-code" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/wpml-language-code.png" alt="" width="433" height="338" /><p class="wp-caption-text">WPML&#39;s language code</p></div>
<p>The logic that we add uses WPML&#8217;s language code constant &#8211; ICL_LANGUAGE_CODE (<a href="http://wpml.org/documentation/support/wpml-coding-api/">reference</a>). For example, for English we add:</p>
<pre>ICL_LANGUAGE_CODE == 'en'</pre>
<p>This condition tells Widget Code to display this widget only on English pages.</p>
<p>We repeat this for all the copies that we created.</p>
<h2>The result &#8211; different widgets per language</h2>
<p>You should expect to see the different widgets per language now.</p>
<table>
<tr>
<th style="width:50%;">English page</th>
<th style="width:50%;">German page</th>
</tr>
<tr>
<td><img src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/english-widget.png" alt="" title="english-widget" width="215" height="200" class="alignnone size-full wp-image-7158" /></td>
<td><img src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/german-widget.png" alt="" title="german-widget" width="218" height="200" class="alignnone size-full wp-image-7159" /></td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://wpml.org/2011/03/howto-display-different-widgets-per-language/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>WPML with W3TC for Fast and Efficient Multilingual Websites</title>
		<link>http://wpml.org/2011/03/wpml-with-w3tc/</link>
		<comments>http://wpml.org/2011/03/wpml-with-w3tc/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 10:17:18 +0000</pubDate>
		<dc:creator>Amir</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wpml.org/?p=7053</guid>
		<description><![CDATA[Since WPML turned commercial, wpml.org is dealing with much more traffic. Two weeks ago, our server was running on 95% load and response time was over 10 seconds. With W3TC, our load is back to 5% and response time is around 300ms. If you&#8217;re not familiar with it, W3TC is a site-performance plugin. It includes [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Since WPML turned commercial, wpml.org is dealing with much more traffic. Two weeks ago, our server was running on 95% load and response time was over 10 seconds. With W3TC, our load is back to 5% and response time is around 300ms.</strong></p>
<p>If you&#8217;re not familiar with it, <a href="http://wordpress.org/extend/plugins/w3-total-cache/">W3TC</a> is a site-performance plugin. It includes page cache but that&#8217;s just the beginning. Beyond the basic page caching, it also minifies JS and CSS files, compresses everything and runs a CDN (content delivery network). Put together, these functions can speed up a site by a huge factor, allowing complex WordPress sites to cope with high-volume traffic.</p>
<h2>Why it&#8217;s so important for WordPress sites?</h2>
<p>A picture is worth a thousand words. This is how our site loads without any caching (generated by <a href="http://tools.pingdom.com/">Pingdom Tools</a>):</p>
<div id="attachment_7058" class="wp-caption alignnone" style="width: 182px"><a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/load-time-no-cache.png"><img class="size-medium wp-image-7058 " title="load-time-no-cache" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/load-time-no-cache-172x300.png" alt="" width="172" height="300" /></a><p class="wp-caption-text">WPML.org load time without any caching &gt; 30 seconds</p></div>
<p>If you think that this is scary, keep in mind that in reality is was worse. This loading time chart was taken when our server is actually running on 5% load. When it really ran without a cache, the server was cooking at 95% load and processing time was much longer. The first byte took 5 seconds to come out and not 1/2 second like you see in this chart.</p>
<p>To fully display our home-page, our server had to send 77 files. Even this chart, running at 5% server load, ends with a timeout at 30 seconds (see the red lines).</p>
<p><strong>Is it because of sloppy programming and bad design practices? No.</strong></p>
<p>The power of WordPress comes from the modularity. You can choose any theme you like, with any combination of plugins. It means that each of these is developed independently and runs with its own resources. Most plugins that you enable include several CSS and Javascript files and contribute to the PHP and MySQL processing efforts. You could optimize it manually, but then you&#8217;d lose all this great modularity and we&#8217;re back to square zero.</p>
<p>Run your site through Pingdom&#8217;s tools, or other page-load time measurement (there&#8217;s a <a href="https://addons.mozilla.org/en-us/firefox/addon/load-time-analyzer/">Firefox add-on</a> for it). See which files load and their order. You&#8217;ll notice that CSS files load images and other CSS and that there are heaps of Javascript files loaded for each page.</p>
<p>To get your appetite going, here&#8217;s what we achieved using all the bells and whistles from W3TC:</p>
<div id="attachment_7062" class="wp-caption alignnone" style="width: 310px"><a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/wpml-with-cache.png"><img class="size-medium wp-image-7062  " title="wpml-with-cache" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/wpml-with-cache-300x217.png" alt="" width="300" height="217" /></a><p class="wp-caption-text">WPML.org page load time with full caching, minify and CDN &lt; 2 seconds</p></div>
<p>The numbers you&#8217;re seeing here are correct. A total of 28 files are fetched to display the page. 5 files come from wpml.org (our own server) and the rest come from the CDN (content delivery network). PHP barely needs to do anything to serve this page, except check that it&#8217;s in the cache and a few other tiny checks.</p>
<p>The entire page loads in less than 2 seconds and causes load that we can hardly measure on the server. We&#8217;re happy, visitors are happy and even Google is happy.</p>
<h2>Step 1) Page Cache</h2>
<p>The first and most basic thing you&#8217;d want to do is enable page caching. Go to <strong>Performance</strong>, enable W3TC and configure the <strong>Page Caching</strong> section.</p>
<div id="attachment_7065" class="wp-caption alignnone" style="width: 310px"><a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/w3tc-page-caching.png"><img class="size-medium wp-image-7065" title="w3tc-page-caching" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/w3tc-page-caching-300x236.png" alt="" width="300" height="236" /></a><p class="wp-caption-text">Page-caching settings</p></div>
<p>For page caching, we stayed with the basic settings. One thing that we added was to exclude the client account and download sections from the page cache, so that W3TC doesn&#8217;t interfere with WPML client accounts and WPML downloads.</p>
<p>If you&#8217;re using an opcode cache, W3TC will take advantage of this to further speed your site. We&#8217;re not using it, but it&#8217;s worthwhile if you&#8217;re running complex PHP processing that&#8217;s not cached.</p>
<h2>Step 2) Minify &#8211; pack and compress CSS and Javascript</h2>
<p>Remember all those CSS and JS files that the theme and plugins add? Now is the time to fix the load they&#8217;re causing.</p>
<p>Minify collects multiple resource files, packs them into a single file and compresses it. The result is one larger file instead of dozens of tiny ones.</p>
<p>Even though the total size may shrink by only 50%, the load that this saves is huge. Instead of the browser having to issue multiple HTTP requests and get many tiny files, it issues a single request and gets them all together. This change is probably the biggest contributor to improving your site&#8217;s responsiveness &#8211; especially to new visitors (who don&#8217;t have your CSS and JS cached already).</p>
<p>Click on the <strong>Help</strong> button at the top of the page. W3TC will run through your entire site and look for resource files. Then, it lets you choose which to combine. Normally, you can select all, but you need to pay some attention to what you&#8217;re doing, as this can change the loading order.</p>
<p>Once you&#8217;ve selected the CSS and JS files to minify, you need to make sure that their order is correct.</p>
<p>For CSS files, drag files up and down in the list.</p>
<div id="attachment_7067" class="wp-caption alignnone" style="width: 310px"><a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/w3tc-minify-css.png"><img class="size-medium wp-image-7067 " title="w3tc-minify-css" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/w3tc-minify-css-300x194.png" alt="" width="300" height="194" /></a><p class="wp-caption-text">W3TC CSS Minify list</p></div>
<p>The order you see in this list should match the order in which CSS files are loaded without Minify. You can see that in your HTML page source.</p>
<p>Javascript files are a little trickier. Here, the loading order is even more critical as the wrong order will result in JS errors and broken functionality.</p>
<div id="attachment_7068" class="wp-caption alignnone" style="width: 310px"><a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/w3tc-minify-js.png"><img class="size-medium wp-image-7068" title="w3tc-minify-js" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/w3tc-minify-js-300x197.png" alt="" width="300" height="197" /></a><p class="wp-caption-text">W3TC Javascript Minify</p></div>
<p>W3TC lets you choose which JS files go to the header section and which go to the body. For example, the Google Analytics scripts would go just before , which jQuery goes into the header, as it needs to run first (and outside of the minify list).</p>
<h2>Step 3) Content Delivery Network (CDN)</h2>
<p>For us, the icing on the cake comes in the form of a beautifully functional CDN.</p>
<p>Configuring and running a CDN is beyond the scope of this post, as it requires setting up and account in a 3rd party service.</p>
<p>For our own sites, we using Amazon S3 for storage and CloudFront for delivery. There are other fine options out there which you can explore and compare.</p>
<p>Once your CDN account is set up, W3TC sends your local files to the CDN and replaces links from your server to the files in the CDN. Then, your server only sends the HTML files and the CDN takes care of the rest.</p>
<p>While your server is a single machine, the CDN is actually a network of servers. It will send the files from the closest server to each visitor. CDNs can serve static files much faster than any single server can. By using a CDN, you improve your visitors&#8217; experience and drastically reduce your server&#8217;s bandwidth and network utilization.</p>
<p>&nbsp;</p>
<div id="attachment_7070" class="wp-caption alignnone" style="width: 294px"><a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/w3tc-cdn.png"><img class="size-medium wp-image-7070" title="w3tc-cdn" src="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2011/03/w3tc-cdn-284x300.png" alt="" width="284" height="300" /></a><p class="wp-caption-text">W3TC CDN settings</p></div>
<p>&nbsp;</p>
<p>You should follow the CDN setup wizard in W3TC. It will help you transfer the media library, theme and plugin resources to the CDN.</p>
<p><strong>Having fun with site performance optimization? Let us know by leaving a comment here!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://wpml.org/2011/03/wpml-with-w3tc/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Theme and Plugin Translation, WPML or MO Files?</title>
		<link>http://wpml.org/2010/06/theme-and-plugin-translation-wpml-or-mo-files/</link>
		<comments>http://wpml.org/2010/06/theme-and-plugin-translation-wpml-or-mo-files/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 08:32:46 +0000</pubDate>
		<dc:creator>Amir</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wpml.org/?p=5025</guid>
		<description><![CDATA[WPML 1.7.9 includes a significant change in the String Localization engine. We&#8217;ve talked about it before, but I think that we never really gave a comprehensive guide about translating themes and plugins. Here goes. Translation Languages First, let&#8217;s talk a minute about which languages you&#8217;re translating between. If the default language of your site is [...]]]></description>
			<content:encoded><![CDATA[<p><strong>WPML 1.7.9 includes a significant change in the String Localization engine.</strong></p>
<p><strong>We&#8217;ve <a href="http://wpml.org/2010/06/default-language-other-than-english/">talked about it before</a>, but I think that we never really gave a comprehensive guide about translating themes and plugins. Here goes.</strong></p>
<h2>Translation Languages</h2>
<p>First, let&#8217;s talk a minute about which languages you&#8217;re translating between.</p>
<p>If the default language of your site is English, you can just skip this section. Otherwise, please pay full attention &#8211; this is important stuff.</p>
<p>Your theme and plugins needs to be translated from English. Even if the default language for your site is Spanish (for example) and you&#8217;re translating only to Portuguese (yet, another example), English is involved too.</p>
<p>The original language of almost all themes and surely all plugins is English. If you&#8217;re using .mo files, they would include translation from English to both Spanish and Portuguese. Yup, although you don&#8217;t have English anywhere in your site&#8217;s contents, it still appears in many places, so you actually need to translate from English to your languages.</p>
<p>Normally, folks don&#8217;t need to worry too much about it, because they just download .mo files. So, why are we making a big deal of it?</p>
<p>Because WPML&#8217;s String Localization mechanism works exactly like GetText. It will translate everything from English to other languages. This means that if you&#8217;re using it also to translate admin texts, these texts need to be in English. We&#8217;ve talked about this a bit (with an example) in this <a href="http://wpml.org/2010/06/default-language-other-than-english/">blog post</a>.</p>
<h2>How to Translate</h2>
<p>Now that we understand which languages to use, we need to start translating.</p>
<p>WPML gives you two options for translating strings. You can either use the GetText .mo files or use WPML&#8217;s String Translation mechanism.</p>
<p>These two solutions are functionally very similar. There&#8217;s also no performance difference. The only difference is the process you&#8217;re using.</p>
<p>Have a look at our <a href="../documentation/getting-started-guide/theme-localization/">theme  localization</a> guide. It shows exactly where to click and what to do  to scan your theme and plugins.</p>
<h3>Translating With WPML&#8217;s String Translation</h3>
<p>WPML&#8217;s String Translation editor allows you to enter translations for each string in each language. It&#8217;s a simple editor, with search functionality. This interface is convenient if you&#8217;re translating for yourself, or if your translators already have WordPress user accounts.</p>
<p>In case you&#8217;re using our <a href="http://wpml.org/documentation/content-translation/">professional translation</a>, your translators don&#8217;t need to touch the String Translation editor or log in to WordPress. Just click on the button to send the strings to your translators and you&#8217;re done.</p>
<h3>Translating Using .mo Files</h3>
<p>MO files are like dictionaries, telling how to translate strings from on language to another. You would need to have as many MO files as your site&#8217;s languages.</p>
<p>The process of translating with MO files goes like this:</p>
<ol>
<li><strong>Create a POT file with the strings to translate.</strong> There are many tools for that. WPML includes a robust PHP scanner and can produce these POT files for you.</li>
<li><strong>Send the POT files to your translators.</strong> You might want to know that ICanLocalize also provides <a href="http://www.icanlocalize.com/site/services/software-localization/po-file-translation/">translation service for PO / POT files</a>. You&#8217;re also welcome to learn more about it in the <a href="http://www.icanlocalize.com/site/tutorials/how-to-translate-with-gettext-po-and-pot-files/">tutorial on translating PO and POT files</a>.</li>
<li><strong>Get the PO and MO files from the translators and upload to your site.</strong> Each translator should return at least a PO (Portable Object) file. The PO file is the text version of the translation. From that, you can create a MO (Machine Object) file.</li>
</ol>
<h2>How is it Working for You?</h2>
<p>Leave a comment and tell what you&#8217;re doing for theme and plugins localization!</p>
]]></content:encoded>
			<wfw:commentRss>http://wpml.org/2010/06/theme-and-plugin-translation-wpml-or-mo-files/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Testing on WordPress 3.0</title>
		<link>http://wpml.org/2010/05/testing-on-wordpress-3-0/</link>
		<comments>http://wpml.org/2010/05/testing-on-wordpress-3-0/#comments</comments>
		<pubDate>Thu, 27 May 2010 14:16:00 +0000</pubDate>
		<dc:creator>Amir</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wpml.org/?p=4780</guid>
		<description><![CDATA[Following the good experience we had with WordPress 3.o, it looks like it&#8217;s time to start thinking about upgrading. But, with great power comes great responsibility. WordPress 3.0 is a major change from previous versions. True, it uses the same tables, but a lot of the API has changed. This can cause existing plugins and [...]]]></description>
			<content:encoded><![CDATA[<p>Following the <a href="http://wpml.org/2010/05/custom-types-in-wordpress-3-simplified-our-site/">good experience</a> we had with WordPress 3.o, it looks like it&#8217;s time to start thinking about upgrading.</p>
<p>But, with great power comes great responsibility. WordPress 3.0 is a major change from previous versions. True, it uses the same tables, but a lot of the API has changed. This can cause existing plugins and your theme to go wild.</p>
<p>I&#8217;d like to tell about what we did to make sure everything runs smooth after the migration.</p>
<h2>Migrating to WordPress 3.0</h2>
<h3>1. Backup</h3>
<p>First, you should do a complete backup. I just zipped everything from the <em>wordpress</em> directory (including WordPress core itself). Then, created a database backup.</p>
<p>You can make selective file backup as well, but a few more MB of backup are not going to hurt anyone and its way easier to use, should anything go wrong.</p>
<h3>2. Create a test site</h3>
<p>Going from WordPress 2.9.0 to 2.9.2 is pretty safe, but the jump to WordPress 3.0 calls for a staging site.</p>
<p>Create a new test site and unzip the files backup you made before.</p>
<p>Next, you need to copy the database.</p>
<p>For this, you can&#8217;t just copy. You need to edit the SQL dump. Open any text editor and do a global replace for the site&#8217;s domain. Supposing your live site is www.justgreat.com and your staging site is dev.justgreat.com, replace all:</p>
<pre>www.justgreat.com -&gt; dev.justgreat.com</pre>
<p>This SQL dump replacement means that everything in the staging site goes to the correct URL. Now, you can apply the database.</p>
<h3>3. Check that your test site is good</h3>
<p>So far, we haven&#8217;t done much. We just have a full copy of our live site where we can test on. Check that it works correctly and we&#8217;ll move on.</p>
<h3>4. Update to WordPress 3.0</h3>
<p>And, we&#8217;re ready. Now, get the <a href="http://wordpress.org/nightly-builds/wordpress-latest.zip">latest WordPress nightly build</a>. Unzip it over your current version <strong>in the staging site</strong>.</p>
<p>Log in to the WordPress Admin. The first thing you&#8217;ll see if that WordPress suggests to update the database.</p>
<p>And, you&#8217;re done. Now, you&#8217;re seeing how your site looks like in WordPress 3.0.</p>
<p><strong>Is it working?</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://wpml.org/2010/05/testing-on-wordpress-3-0/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Multilingual Themes that Translate Well</title>
		<link>http://wpml.org/2010/04/multilingual-themes-that-translate-well/</link>
		<comments>http://wpml.org/2010/04/multilingual-themes-that-translate-well/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 08:30:25 +0000</pubDate>
		<dc:creator>Amir</dc:creator>
				<category><![CDATA[Multilingual]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wpml.org/?p=4534</guid>
		<description><![CDATA[GetText allows translating texts in themes and plugins, but in order to work right, you must create texts that translate well. We&#8217;ll show you frequent mistakes and how to correct them. GetText is a GNU&#8217;s text localization package. It allows replacing text in one language with texts in another language. We&#8217;ve already talked about using [...]]]></description>
			<content:encoded><![CDATA[<p><strong>GetText allows translating texts in themes and plugins, but in order to work right, you must create texts that translate well. We&#8217;ll show you frequent mistakes and how to correct them.</strong></p>
<p><a href="http://www.gnu.org/software/gettext/">GetText</a> is a GNU&#8217;s text localization package. It allows replacing text in one language with texts in another language.</p>
<p>We&#8217;ve already talked about <a href="http://wpml.org/2009/05/wordpress-theme-localization/">using GetText to build multilingual themes</a>. Now, we&#8217;ll talk about how to make the theme&#8217;s texts translatable, from the translator&#8217;s point of view.</p>
<h2>Complete sentences only, please</h2>
<p>Translators cannot accurately translate single words. They need to see the entire sentence in order to translate correctly.</p>
<p>For example, what does <strong><em>You must be</em></strong> mean?</p>
<p>In English, the word <strong><em>be</em></strong> has one meaning. But, in Spanish, <strong><em>be</em></strong> mean what you are (<em>ser</em>) or where you are (<em>estar</em>). There&#8217;s no way a translator can translate this correctly without seeing the entire sentence.</p>
<p>This is the code that&#8217;s responsible for the text:</p>
<p><code>&lt;?php _e('You must be') ?&gt; &lt;a href="&lt;?php echo get_option('siteurl'); ?&gt;/wp-login.php?redirect_to=&lt;?php echo urlencode(get_permalink()); ?&gt;"&gt;&lt;?php _e('logged in') ?&gt;&lt;/a&gt; &lt;?php _e('to post a comment.') ?&gt;</code></p>
<p>So, what do we do?</p>
<h2>Using full sentences with placeholders</h2>
<p>What we&#8217;ve actually done in this example is concatenate several parts into a sentence. The way we did it broke the sentence into different pieces, losing all meaning in the process.</p>
<p>Here is this same thing, built with a single sentence a placeholder:</p>
<p><code>&lt;?php printf(__( 'You must be &lt;a%s&gt;logged in&lt;/a&gt; to post a comment' ), ' href="'.get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode(get_permalink()) . '"') ?&gt;</code></p>
<p>What we&#8217;ve done is:</p>
<ol>
<li>Create one large text that includes a placeholder.</li>
<li>Use printf to replace the placeholder with an actual value.</li>
</ol>
<p>The translator now needs to translate this sentence:</p>
<blockquote><p><em>You must be logged in to post a comment</em></p></blockquote>
<p>The translator can easily translate this entire sentence.  No questions to ask and no problems translating!</p>
<p>Besides being easier to translate, we need to remember that in different languages words appear in different order. Supplying the complete sentence with placeholders will allow the translator to flip the order of words and produce grammatically correct (and sensible) transaltions.</p>
<h2>Really advanced case (appears in every WP site)</h2>
<p>Look at this PHP code. It appears in almost every WordPress site in the comments section.<br />
<code>&lt;h3&gt;&lt;?php comments_number(__('No Responses'), __('One Response'), __('% Responses') );?&gt;<br />
&lt;?php _e('to') ?&gt; &amp;#8220;&lt;?php the_title(); ?&gt;&amp;#8221;&lt;/h3&gt;</code></p>
<p>The translator would have to translate the word <strong><em>to</em></strong>. But, it&#8217;s impossible without understanding how <strong><em>to</em></strong> is used in the sentence.</p>
<p>The word <strong><em>to</em></strong> is part of a sentence, which would be:</p>
<blockquote><p>3 Responses <strong>to</strong> new widgets</p></blockquote>
<p>Once the translator sees the entire sentence, it all becomes clear and easy to translate.</p>
<p>To turn this into a single sentence, we&#8217;ll use this PHP code:<br />
<code>&lt;h3&gt;&lt;?php printf(__('%s to %s'),<br />
get_comments_number_ml(__('No Responses'), __('One Response'), __('% responses') ),<br />
'&amp;#8220;' . get_the_title() . '&amp;#8221;')?&gt;&lt;/h3&gt;</code></p>
<p>This code produces a full sentence to translate. Now, the translator can produce correct translation to your comments heading.</p>
<p><em>Note: we&#8217;ve replaced the standard WP get_comments_number with an identical function that returns the comment count as a value and doesn&#8217;t echo to the screen. You can download this PHP code from <a href="http://d2salfytceyqoe.cloudfront.net/wp-content/uploads/2010/04/get_comments_number_ml.zip">get_comments_number_ml.zip</a>.</em></p>
<h2>What about your themes?</h2>
<p>Are your multilingual themes built for correct translation?</p>
<p>An easy way to test is to open your <em>.po</em> file in <em>poedit</em> and review the strings. If you&#8217;re seeing anything that isn&#8217;t clear by itself, look for it in the source and revise.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpml.org/2010/04/multilingual-themes-that-translate-well/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (Requested URI is rejected)
Database Caching 52/190 queries in 0.158 seconds using apc
Object Caching 1284/1415 objects using apc
Content Delivery Network via Amazon Web Services: CloudFront: d2salfytceyqoe.cloudfront.net

Served from: wpml.org @ 2012-02-04 04:08:20 -->
