<?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>Thirtysomething &#187; ProjectSomething</title>
	<atom:link href="http://www.thirtysomething.it/category/projectsomething/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thirtysomething.it</link>
	<description>Se tutto va bene per una decina d'anni sono a posto...</description>
	<lastBuildDate>Thu, 15 Oct 2009 12:37:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Restyling LinguaPlone Language selector</title>
		<link>http://www.thirtysomething.it/2009/10/15/restyling-linguaplone-language-selector/</link>
		<comments>http://www.thirtysomething.it/2009/10/15/restyling-linguaplone-language-selector/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 12:23:17 +0000</pubDate>
		<dc:creator>Thirty</dc:creator>
				<category><![CDATA[ProjectSomething]]></category>

		<guid isPermaLink="false">http://www.thirtysomething.it/?p=148</guid>
		<description><![CDATA[Plone is great and LinguaPlone is very useful to handle a multilanguage site in a very few steps.
What is kind of complex from a designer point of view is the control of the appearence of the language selector, aka the list of flags that the user can select to switch language.
Right now a basic Language [...]]]></description>
			<content:encoded><![CDATA[<p>Plone is great and LinguaPlone is very useful to handle a multilanguage site in a very few steps.</p>
<p>What is kind of complex from a designer point of view is the control of the appearence of the language selector, aka the list of flags that the user can select to switch language.</p>
<p>Right now a basic Language selector looks like this</p>
<p><img class="alignnone size-full wp-image-149" title="language_basic" src="http://www.thirtysomething.it/wp-content/language_basic.png" alt="language_basic" width="125" height="41" /></p>
<p>Which is fine but sometime could be not the way the designer has imagined the site. I&#8217;m talking about something like this:</p>
<p><img class="alignnone size-full wp-image-150" title="language_css" src="http://www.thirtysomething.it/wp-content/language_css.png" alt="language_css" width="107" height="50" /></p>
<p>As you can see the images AND the order are different.</p>
<p>The &#8220;right&#8221; way to do this would be <a href="http://lionfacelemonface.wordpress.com/2009/01/29/adventures-in-theming-resources/">something easy</a> for a developer, but very complicated for a designer with css/html skills.</p>
<p>Let&#8217;s take a look to the code of the Language Selector:</p>
<pre class="brush:py">
<tal:language tal:condition="view/available">
<ul id="portal-languageselector"
        tal:define="showFlags view/showFlags;
                    languages view/languages;">
        <tal:language repeat="lang languages">
<li tal:define="code lang/code;
                        selected lang/selected"
            tal:attributes="class python: selected and 'currentLanguage' or '';">
                <a href=""
                   tal:define="flag lang/flag|nothing;
                               name lang/native|lang/name"
                   tal:attributes="href lang/url;
                                   title name">
                    <tal:flag condition="python:showFlags and flag">
                        <img
                             width="14"
                             height="11"
                             alt=""
                             tal:attributes="src string:${view/portal_url}${flag};
                                             alt python: name;
                                             title python: name;
                                             class python: selected and 'currentItem' or '';" />
                    </tal:flag
                    ><tal:nonflag condition="python:not showFlags or not flag"
                                 replace="name">language name</tal:nonflag
                    ></a>&nbsp;
        </li>

        </tal:language>
    </ul>

</tal:language>
</pre>
<p>It works but it shows some problems:<br />
- the image are hard coded (width=&#8221;14&#8243;  height=&#8221;11&#8243;)<br />
- there is no class attached to the &lt;li&gt; element to control the order of the flags</p>
<p>Removing the image, adding a class to the &lt;a&gt; element AND to the &lt;li&gt; element, and cooking some css gives you control on the images and the order of the flags.</p>
<p>This is the plone.app.i18n.locales.languageselector modified:</p>
<pre class="brush:py">
<tal:language tal:condition="view/available">
<ul id="portal-languageselector"
        tal:define="showFlags view/showFlags;
                    languages view/languages;">
        <tal:language repeat="lang languages">
<li tal:define="code lang/code;
                        selected lang/selected"
            tal:attributes="class python: selected and 'currentLanguage '+code or code;">
                <a href=""
                   tal:define="flag lang/flag|nothing;
                               name lang/native|lang/name"
                   tal:attributes="href lang/url;
                                   class name;
                                    title name ">
                    <tal:flag condition="python:showFlags and flag">

                    </tal:flag
                    ><tal:nonflag condition="python:not showFlags or not flag"
                                 replace="name">language name</tal:nonflag
                    ></a>&nbsp;
        </li>

        </tal:language>
    </ul>

</tal:language>
</pre>
<p>And this are some basic css:</p>
<pre class="brush:css">
#portal-languageselector li
display:inline;
position:relative;
margin-bottom:0;
}

#portal-languageselector li.it {
float:left;
}

#portal-languageselector li.en {
float:right;
left:-38px;
}

#portal-languageselector li.es {
float:right;
left:24px;
}

#portal-languageselector li.fr {
float:right;
left:26px;
}

#portal-languageselector a
height:20px;
width:20px;
display:block;
}

#portal-languageselector a.English {
background: transparent url(gb.gif) no-repeat 0 0;
}

#portal-languageselector a.Français {
background: transparent url(fra.jpg) no-repeat 0 0;
}

#portal-languageselector a.Español {
background: transparent url(esp.jpg) no-repeat 0 0;
}

#portal-languageselector a.Italiano {
background: transparent url(ita.jpg) no-repeat 0 0;
}
</pre>
<p>Of course you need to upload the images as well, but that&#8217;s the easy part. And it&#8217;s also easy add hover and selected effect to the flags using the appropriate css.</p>
<p>Thanks to teix for the code hint. This is my first plone post in english, so please don&#8217;t be to hard on me. The version of LinguaPlone used in this example is 3b4.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thirtysomething.it/2009/10/15/restyling-linguaplone-language-selector/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Primi Passi</title>
		<link>http://www.thirtysomething.it/2009/04/10/primi-passi/</link>
		<comments>http://www.thirtysomething.it/2009/04/10/primi-passi/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 14:16:04 +0000</pubDate>
		<dc:creator>Thirty</dc:creator>
				<category><![CDATA[ProjectSomething]]></category>

		<guid isPermaLink="false">http://www.thirtysomething.it/?p=94</guid>
		<description><![CDATA[Via Carducci, ore 11:30, venerdì 10 aprile 2009.

Trieste Human Traffic from Martino Stenta on Vimeo.
]]></description>
			<content:encoded><![CDATA[<p>Via Carducci, ore 11:30, venerdì 10 aprile 2009.<br />
<object width="400" height="225" data="http://vimeo.com/moogaloop.swf?clip_id=4090675&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=4090675&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /></object></p>
<p><a href="http://vimeo.com/4090675">Trieste Human Traffic</a> from <a href="http://vimeo.com/user1562084">Martino Stenta</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thirtysomething.it/2009/04/10/primi-passi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
