i18n = g11n + L10n
description
Transcript of i18n = g11n + L10n
i18n = g11n + L10n
Adam Long & Sam SoubraQSR International
March 2009
i18n = g11n + L10n
• What does the abbreviation stand for– Internationalization = Globalization + Localization
• Or– According to Microsoft
About QSR International
Established in 1995
Independent software vendor based in
Melbourne, Australia
90% of revenue from exports
400,000 customers in 90
countries
Governor of Victoria Export Award for ICT, Winner 2006 & 2008
Microsoft Gold Partner
About QSR International Products
2006g11n
2007Japanese L10n
2008Chinese,
Spanish L10n
2009French,
German L10n
Why develop software for the global marketplace?
•Australia represents 1% of the global software market
Increase revenue potential
•Servicing a larger market is more cost-effective and efficient
Leverage development costs
•Consumers and businesses operate across international borders
Increase customer satisfaction
•Gain competitive advantage and be the leader in your industryLeadership
World Population(Source: Wikipedia)
0.3%
World Language Speakers (millions)(Source: KryssTal 2006)
Mandari
n
English
Hindi
Span
ishArab
ic
Russian
Portugu
ese
Bengali
Malay
French
Japan
ese
German
-
200
400
600
800
1,000
1,200
World Nominal GDP (billions USD)(Source: World Bank 2007)
United St
ates
Japan
German
yChina
United Kingd
omFra
nce Italy
Spain
Canad
aBraz
il
Russia
India
South Korea
Mexico
Australi
a
Rest of W
orld $-
$2,000 $4,000 $6,000 $8,000
$10,000 $12,000 $14,000 $16,000
Globalization (g11n)
g11n is the process of developing software whose features and code design are not solely based on a single language or locale. It involves:
Alphabets/scripts
Date/time formats, calendars
Formatting of numbers
Writing direction
Time zones
Currency
Paper sizes
Localization (L10n)
L10n is the process of adapting software for a specific region or language. It involves:
Language translation
Local content
Cultural values
Aesthetics
L10n of NVivo in Spanish
L10n of NVivo in Chinese
g11n CodeRecommendations
CurrentUICulture
• Automatically set by .NET based on user’s Windows settings• Thread.CurrentUICulture can get/set System.Globalization.CultureInfo• CultureInfo defines a culture, ISO definition, e.g. “en-US”, “en-GB”, “ja-JP”
Unicode
• System.String has useful methods such as ToUpper(), ToLower()• System.Char has useful methods such as IsLetter(), IsPunctuation()• Beware that Text files may require handling of different encodings (e.g. Unicode, UTF8, Western European Windows) using System.Text.EncodingInfo
String Comparisons
• Always pass Culture.CompareInfo as a parameter when using String.Compare(), String.CompareTo(), String.ToUpper() and String.ToLower()• E.g. Turkish has four i’s => İ & i, plus I & ı.
g11n CodeRecommendations
Date and Time
• System.DateTime Class provides support for universal and local date times• Store date and time data in universal time• Display local date and time to user
Formatting
• Numeric and DateTime values should be formatted according to CurrentUICulture• e.g. 31/12/2009 (en-GB) vs. 12/31/2009 (en-US)• e.g. 123,456.78 (en-AU) vs. 123.456,78 (de-DE)
Paper Size
• Use Default Printer settings, i.e. do not rely on the user having A4 paper
File System
• Use SHGetKnownFolderPath() rather than hard-coded paths for folders such as MyDocuments• Use Security ID rather than System Resource Name, e.g. “NT AUTHORITY\Network Service” may be named differently on different language versions of Windows
g11n DatabaseRecommendations
Collation
• Use Binary collation (_BIN or _BIN2) suffix when installing database to ensure comparisons (WHERE, GROUP BY, SORT BY) are evaluated correctly
Data Types
• Use Unicode data types NCHAR, NVARCHAR, NTEXT rather than CHAR, VARCHAR, TEXT
.Net Framework Namespace
System.Globalization
Provides National Language Support
• Date and time formatting
• String comparison and sorting
• Numeric formatting
• Calendars• etc
System.Text
Unicode used internally
Conversion from code pages through
Encoding classes
System.Resources
RESX files containing culture specific resources
Localized satellite assemblies
CultureInfo Class
The CultureInfo class provides all the basic functionality for changing the encoding format, which in turn controls structures such as the language, writing systems and calendar used by a particular culture.
In particular, the CultureInfo class maintains the values for CurrentCulture and CurrentUICulture.
CurrentCulture indicates the encoding culture used for locale-dependent formatting such as with dates. CurrentUICulture indicates the encoding culture used for resource lookups
CultureInfo Class
Every locale is identified by a culture, using the format:
• Language code:• A two-letter lowercase for a language. Eg. “en”, “ar”, “zh”
• Country/Region code:• A two-letter uppercase for a country or a region. Eg. “AU”, “LB”, “CN”
Cultures are of two types:
• Neutral culture:• A culture that is linked only to a language and not to a country. Eg. “ru” is a neutral code.
• Specific culture:• A culture that is linked to both a country and a language. Eg. “ru-RU” is a specific code.
<Language code>-<Country/Region code>
“en-AU”, “en-US”, “es-MX”, “zh-CN”
Comparing and Sorting Data
Different cultures use different alphabetical orders to sort strings and different cultures also compare strings differently. The culture aware .NET Framework will handle most situations automatically via the following features:
• The String.Compare method compares strings• The CultureInfo.CompareInfo object can search for substrings• The Array.Sort method sorts the members of an array by the alphabetical order rules• The SortKey.Compare method also compares strings
All according to the rules of the CultureInfo referenced by the CurrentCulture property.
g11n Code Demo
L10n CodeRecommendations
Application
• Localize all text labels that are displayed to the user• Allow the user to change the display font
Forms & Controls
• Set the “localizable” property to True• Allow 40% more space for labels than in English
Messages & Strings
• Never hard-code, store as a resource• Avoid string concatenation, i.e. use parameterized resource strings
Icons & Graphics
• Avoid text and cultural connotations to minimize translation costs
Resource Files
The most straightforward method of dealing with localizable resources is to put everything in some type of resource repository like Windows resource files and .NET assemblies
Resource repositories tend to be easy to edit, and they eliminate the need for recompiling source code
Resource Generation
.resx file• X
ML based file containing descriptions of resources
.resources file• R
esGen tool compiles .resx files into binary files containing resources
.resources.dll – satellite assembly• T
he .resources file is embedded into an assembly using either the assembly linker tool or language compiler
Satellite Assemblies
Satellite AssembliesCulture-Specific Subdirectories
LocalizedApp.Resources.dll
LocalizedApp.Resources.dll
LocalizedApp.Resources.dll
LocalizedApp.exe
Resources
\en-US
\es
\es-MX
Main AssemblyApplication Directory
Code
Types
Form1 Form2
Form1
Form1
Form1
Control1
Form2
Form2
Form2
Control1
Control1
Control1
Localizable Property
Localizable = False (default)
• this.button1.TabIndex = 0;• this.button1.Text = "button1";
Localizable = True
• this.button1.TabIndex = ((int)(resources.GetObject("button1.TabIndex")));
• this.button1.Text = resources.GetString("button1.Text");
Locating Resources
First, attempt to find the resource in current thread’s UI culture• e
n-AU
Then try the neutral parent culture• e
n
Finally use the default resource from main assembly (otherwise throw exception)
en-AU
en-US
en
(default)
L10n Code Demo
L10n Quality AssuranceRecommendations
Viewing context/usage is important when translating and reviewing
Use a specialist software translator
Use a native speaking reviewer with domain expertise
Test on different language operating systems
L10n GeneralRecommendations
Planning
• Plan for additional Effort, Lead-time and Coordination
Review 3rd Party Components
• Ensure they support g11n and L10n
Consider what needs to be translated
• Application• User assistance materials• Marketing materials• Support materials• End User License Agreement (legal issues in translation)
Why good translations are important
• Pepsi used "Come alive with the Pepsi Generation" campaign successfully in the Western World
• In Taiwan, however, it came out as "Pepsi will bring your ancestors back from the dead"
Why good translations are important
• In the late '70s, the American computer company Wang was puzzled why its British branch refused to use its latest motto "Wang Cares".
• To British ears the motto sounded too close to "wankers".
Resources
• This Presentation– http://chieftechnologyofficer.wordpress.com
• Globalization Step-by-Step– http://msdn.microsoft.com/en-au/goglobal/bb688110.aspx
• Internationalize Your ASP.NET Applications– http://www.devx.com/dotnet/Article/6997
• MultiLingual Guides– https://www.multilingual.com/guides.php