<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>polylang on Silicone&#39;s web</title>
		<link>https://silicone.homelinux.org/tags/polylang/</link>
		<description>Recent content in polylang on Silicone&#39;s web</description>
		<generator>Hugo</generator>
		<language>fr</language>
		
		
		
		
			<lastBuildDate>Sun, 23 Feb 2014 21:57:02 +0100</lastBuildDate>
		
			<atom:link href="https://silicone.homelinux.org/tags/polylang/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title> From gengo to polylang: updating the theme</title>
				<link>https://silicone.homelinux.org/2014/02/19/from-gengo-to-polylang-updating-the-theme/</link>
				<pubDate>Wed, 19 Feb 2014 23:28:32 +0100</pubDate>
				<guid>https://silicone.homelinux.org/2014/02/19/from-gengo-to-polylang-updating-the-theme/</guid>
				<description>&lt;p&gt;So I postponed hacking a mode with multiple languages on the same page and decided to set polylang on my &lt;del&gt;production site&lt;/del&gt; (hem) my blog.&lt;/p&gt;&#xA;&lt;p&gt;But Gengo was using some customized template tags so the theme was adapted to it and this needed to be changed.&lt;/p&gt;&#xA;&lt;p&gt;With polylang it’s a lot simpler, all navigation is handled by filters, so only thing really custom had to be written:&lt;/p&gt;&#xA;&lt;p&gt;Basically my hacked version of &lt;code&gt;the_translations&lt;/code&gt; had to be ported. And to keep it simple it can even be part of the &lt;code&gt;functions.php&lt;/code&gt; file in the theme and use the &lt;a href=&#34;http://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/#pll_the_languages&#34; title=&#34;Polylang function reference pll_the_languages&#34;&gt;&lt;code&gt;pll_the_languages&lt;/code&gt;&lt;/a&gt; function.&lt;br&gt;&#xA;I want to display the other language title prefixed by “Language version” written in this language. As the &lt;em&gt;gettext&lt;/em&gt; like functions would only return strings in the current language, I hardcoded those strings, but adding them in Polylang admin “strings translation” would have been nice…&lt;br&gt;&#xA;So here is the code:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; $translation_title=array(&#xA;    &amp;#39;en&amp;#39; =&amp;gt; &amp;#34;English version:&amp;#34;, &#xA;    &amp;#39;fr&amp;#39; =&amp;gt; &amp;#34;Version française&amp;amp;nbsp;: &amp;#34;);&#xA;function my_translations() {&#xA;    global $post;&#xA;    global $translation_title;&#xA;    $post_id=$post-&amp;gt;ID;&#xA;    if ( function_exists(&amp;#39;pll_the_languages&amp;#39;) ) {&#xA;        $translations = pll_the_languages(array(&amp;#39;post_id&amp;#39; =&amp;gt; $post_id, &amp;#39;hide_if_no_translation&amp;#39;=&amp;gt;1, &amp;#39;hide_current&amp;#39;=&amp;gt;1, &amp;#39;raw&amp;#39;=&amp;gt;1));&#xA;        if(!empty($translations)) {&#xA;            foreach($translations as $tr) {&#xA;                $trid=pll_get_post($post_id, $tr[&amp;#39;slug&amp;#39;]);&#xA;                ?&amp;gt;&amp;lt;li lang=&amp;#34;&amp;lt;?php echo esc_attr($tr[&amp;#39;slug&amp;#39;]);?&amp;gt;&amp;#34;&amp;gt;&amp;lt;?php echo $translation_title[$tr[&amp;#39;slug&amp;#39;]]; ?&amp;gt;&amp;lt;a hreflang=&amp;#34;&amp;lt;?php echo esc_attr($tr[&amp;#39;slug&amp;#39;]);?&amp;gt;&amp;#34; href=&amp;#34;&amp;lt;?php echo esc_url($tr[&amp;#39;url&amp;#39;]);?&amp;gt;&amp;#34; rel=&amp;#34;alternate&amp;#34;&amp;gt;&amp;lt;?php echo get_the_title($trid); ?&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;?php&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Instead of porting the old theme, I did build a new one based on &lt;a href=&#34;https://wordpress.org/themes/twentytwelve&#34; title=&#34;Wordpress&amp;#39; Twenty Twelve theme&#34;&gt;WordPress’ Twenty Twelve&lt;/a&gt; updated with my previous header and dark color scheme.&lt;br&gt;&#xA;I also played with a few css3 features for more neon light effects 🙂&lt;/p&gt;&#xA;&lt;p&gt;And here it is !&lt;/p&gt;</description>
			</item>
			<item>
				<title>From gengo to polylang: importing data</title>
				<link>https://silicone.homelinux.org/2014/01/27/from-gengo-to-polylang-importing-data/</link>
				<pubDate>Mon, 27 Jan 2014 23:34:03 +0100</pubDate>
				<guid>https://silicone.homelinux.org/2014/01/27/from-gengo-to-polylang-importing-data/</guid>
				<description>&lt;p&gt;As you might know, my blog is using &lt;a href=&#34;http://silicone.homelinux.org/projects/gengo/&#34;&gt;gengo&lt;/a&gt; to enable translations.&lt;/p&gt;&#xA;&lt;p&gt;But gengo is an old unmaintained plugin (I’m even running a custom version that I recently needed to fix again) so I’d like to migrate away.&lt;/p&gt;&#xA;&lt;p&gt;Recently, I studied the available options (thanks to &lt;a href=&#34;http://codex.wordpress.org/Multilingual_WordPress&#34; title=&#34;Multilingual WordPress&#34; target=&#34;_blank&#34;&gt;Multilingual WordPress&lt;/a&gt; page) and selected &lt;a href=&#34;http://polylang.wordpress.com/&#34; title=&#34;Polylang&#34; target=&#34;_blank&#34;&gt;Polylang&lt;/a&gt;. This one seams to be what Gengo could have been with a rewrite: no extra database tables but using WP3 custom taxonomies. (I can’t find the message but I remember Pixline telling this would be the way to go, so…).&lt;/p&gt;&#xA;&lt;p&gt;Anyway, I started to test Polylang, what it misses compared to Gengo, is the ability to really mix languages on the same page, so it will need some customizations before replacing Gengo here, but it will come.&lt;/p&gt;&#xA;&lt;p&gt;It’s only a few days layer that I found the &lt;a href=&#34;http://wordpress.org/plugins/wpml-to-polylang/&#34; title=&#34;WPML to Polylang&#34; target=&#34;_blank&#34;&gt;WPML to Polylang&lt;/a&gt; plugin.&lt;br&gt;&#xA;This basically triggered the development of &lt;a href=&#34;http://silicone.homelinux.org/git/gengo-to-polylang.git/&#34; title=&#34;Gengo to Polylang&#34; target=&#34;_blank&#34;&gt;Gengo to Polylang&lt;/a&gt; a plugin to import translations informations from Gengo to Polylang.&lt;/p&gt;&#xA;&lt;p&gt;It seams to work… I missed the Site Title and Tagline (but they are no longer translated on my blog so I don’t need it 😕 ) and I did take some shortcut for terms (tags &amp;amp; categories) that are the same in both languages.&lt;br&gt;&#xA;UPDATE 2014-02-04: I fixed that as it caused the tag archive to contain both english and french posts so… also fixed the Title and Tagline part.&lt;/p&gt;&#xA;&lt;p&gt;So if you still have a Gengo powered blog and want to migrate, the code could help you, but don’t just run it blindly, make a backup, setup a test instance and be prepared to hack the code ! You have been warned !&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
