<?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>Cogniza &#187; Localization</title>
	<atom:link href="http://cogniza.com/wordpress/tag/localization/feed/" rel="self" type="application/rss+xml" />
	<link>http://cogniza.com/wordpress</link>
	<description>Business-Intelligence Specialists</description>
	<lastBuildDate>Sat, 30 Apr 2011 13:22:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Crystal Reports: Strategy to Localize a Report (labels)</title>
		<link>http://cogniza.com/wordpress/2009/07/09/crystal-reports-strategy-to-localize-a-report-labels/</link>
		<comments>http://cogniza.com/wordpress/2009/07/09/crystal-reports-strategy-to-localize-a-report-labels/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 15:05:06 +0000</pubDate>
		<dc:creator>Craig Buchanan</dc:creator>
				<category><![CDATA[Business Objects Enterprise]]></category>
		<category><![CDATA[Crystal Reports]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[Localization]]></category>

		<guid isPermaLink="false">http://www.cogniza.com/blog/?p=55</guid>
		<description><![CDATA[Create a Crystal Report that dynamically recalculate its labels based on the Workstation&#8217;s localization settings.

ContentLocale
Crystal Reports XI introduced a keyword named &#8216;ContentLocale&#8217;. This keyword returns the machine&#8217;s locale setting (e.g. &#8216;en_US&#8217; for English (US)).  This value is set in Windows&#8217; Regional Settings Control Panel.
However, this keyword can only be used in formulae that are executed [...]]]></description>
			<content:encoded><![CDATA[<p>Create a Crystal Report that dynamically recalculate its labels based on the Workstation&#8217;s localization settings.</p>
<p><span id="more-55"></span></p>
<h3>ContentLocale</h3>
<p>Crystal Reports XI introduced a keyword named &#8216;ContentLocale&#8217;. This keyword returns the machine&#8217;s locale setting (e.g. &#8216;en_US&#8217; for English (US)).  This value is set in Windows&#8217; Regional Settings Control Panel.</p>
<p>However, this keyword can only be used in formulae that are executed during the report&#8217;s <a href="http://www.cogniza.com/blog/?p=12">Second Pass</a>. The following Record Selection Formula, for example, will generate an error:</p>
<p><code>{my_table.localeName}=ContentLocale </code></p>
<h3>Custom Functions</h3>
<p>This keyword, however, can be used in combination with a Report Custom Function to dynamically and transparently apply localization settings when a report is viewed, even reports that have been saved with data or have been scheduled using Business Objects Enterprise.</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
// Return a localized string for a given Key and Language.<br />
//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Function (Stringvar Key, Stringvar Language)</p>
<p>//define array of keys that are used by Formula fields<br />
Stringvar Array Keys:=["COUNTRY","REGION","CITY"];</p>
<p>//define an array of localized strings for each required language; ensure localized strings are same position as the Key array (correlated arrays).</p>
<p>//determine which array to use<br />
Stringvar Array Values;<br />
Select Language<br />
Case &#8220;en_US&#8221;: Values:=["Country","State","City"]<br />
Case &#8220;it_IT&#8221;: Values:=["Paese","Dichiari","Citta"]<br />
Case &#8220;fr_FR&#8221;: Values:=["Pays","S","C"]<br />
Default: Values:=["Country","State","City"]<br />
;</p>
<p>//set value&#8217;s default value to the Key; useful for debugging purposes.<br />
Stringvar value:=Key;</p>
<p>//iterate through Key array&#8230;<br />
Numbervar i;<br />
for i := 1 To Ubound(Keys) do (<br />
//if value in array matches the specified value, return the value from the localized array<br />
if Keys[i] = Key then (<br />
value:=Values[i];<br />
exit for<br />
)<br />
);</p>
<p>//return value<br />
value;</p>
<h3>Formula Fields</h3>
<p>Create a Formula Field that will act as a label for each desired Key.  Add it to the report&#8217;s canvas.</p>
<p>//{@Country}<br />
getLocalizedString (&#8220;COUNTRY&#8221;, ContentLocale)</p>
<p>//{@Region}<br />
getLocalizedString (&#8220;REGION&#8221;, ContentLocale)</p>
<p>//{@City}<br />
getLocalizedString (&#8220;CITY&#8221;, ContentLocale)</p>
<h4>Advantages</h4>
<ul>
<li>Rapid development and deployment.</li>
<li>Executes during &#8216;view&#8217; time.</li>
<li>Can be saved to Repository and shared with other reports.</li>
</ul>
<h4>Limitations</h4>
<ul>
<li>Crystal Reports is required to maintain the logic and publish changes to the Repository.</li>
<li>Array of Key/Values limited to 1000 items.</li>
</ul>
<h3>Summary</h3>
<p>This approach should help ease the burden of localizing the labels contained in a Crystal Report.</p>
<h3>Download</h3>
<p><a href="/wordpress/wp-content/Report Localization [custom function].12.000.rpt" target="_new">Sample report</a><br />
<a href="/wordpress/wp-content/xtreme.zip" target="_new">Sample database</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cogniza.com/wordpress/2009/07/09/crystal-reports-strategy-to-localize-a-report-labels/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Crystal Reports: getLocalizedString() Function</title>
		<link>http://cogniza.com/wordpress/2006/05/14/crystal-reports-getlocalizedstring-function/</link>
		<comments>http://cogniza.com/wordpress/2006/05/14/crystal-reports-getlocalizedstring-function/#comments</comments>
		<pubDate>Mon, 15 May 2006 00:20:01 +0000</pubDate>
		<dc:creator>Craig Buchanan</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Crystal Reports]]></category>
		<category><![CDATA[Localization]]></category>

		<guid isPermaLink="false">http://www.cogniza.com/blog/?p=54</guid>
		<description><![CDATA[getLocalizedString is a Crystal Reports Custom Function to used convert a constant to a localized string.]]></description>
			<content:encoded><![CDATA[<p>getLocalizedString is a Crystal Reports Custom Function to used convert a constant to a localized string.</p>
<p><span id="more-54"></span><code> //--------------------------------------------------------------------------------<br />
//Author:	Cogniza.com<br />
//Purpose:	Convert a constant value to a localized string<br />
//Parameters:	Key -<br />
//		Lang - ISO language string<br />
//Returns:	localized string<br />
//--------------------------------------------------------------------------------<br />
Function (Stringvar Key, Stringvar Lang)<br />
//define array of keys that are used by Formula fields<br />
Stringvar Array Keys:=["COUNTRY","REGION","CITY"];<br />
//define arrays of localized strings for each required language in the same position as the Key array<br />
Stringvar Array Values;<br />
Select Lang<br />
Case "en_US":	Values:=["Country","State","City"]<br />
Case "it_IT":	Values:=["Paese","Dichiari","Città"]<br />
Case "fr_FR":	Values:=["Pays","état","Ville"]<br />
Default:	    Values:=["Country","State","City"]<br />
//End Select<br />
;<br />
//iterate through Key array...<br />
Numbervar i;<br />
Stringvar value;<br />
for i := 1 To Ubound(Keys) do (<br />
//if value in array matches the specified value, return the value from the localized array<br />
if Keys[i] = Key then<br />
value:=Values[i];<br />
exit for<br />
//end if<br />
);<br />
//return result<br />
value;</code></p>
<h3>Parameters</h3>
<dl>
<dt><em>Key</em></dt>
<dd>The abstract value.</dd>
<dt><em>Lan</em></dt>
<dd>The ISO language string</dd>
</dl>
<h3>Return Value</h3>
<p>A string</p>
<h4>Remarks</h4>
<p>Crystal Reports XI introduces a new keyword named &#8216;ContentLocale&#8217;.  This property returns the  machine&#8217;s locale setting, usually found in the Control Panel&#8217;s Regional Settings (e.g. en_US for English (US)).  However, this keyword can only be used in formulae that are excuted during the report&#8217;s &#8216;Second Pass&#8217; (see <a href="http://www.cogniza.com/blog/?p=52">Crystal Reports: Report Processing Model</a>).  The following Record Selection Formuala, for example, will generate an error:</p>
<p><code> {my_table.localeName}=ContentLocale </code></p>
<p>ContentLocale can be used in combination with a Report Custom Function to dynamically and transparently apply localization settings when a report is viewed, even reports that have been saved with data or have been scheduled using Business Objects Enterprise.</p>
<h4>Example</h4>
<p><code> //if the workstation's ContentLocal is Italian (Italy), then the following will return 'Paese'<br />
getLocalizedString ("COUNTRY",ContentLocale)<br />
</code></p>
<h3>Requirements</h3>
<p>This function requires the use of Crytal Syntax.</p>
]]></content:encoded>
			<wfw:commentRss>http://cogniza.com/wordpress/2006/05/14/crystal-reports-getlocalizedstring-function/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

