Skip to content

Internationalized References to Resources

August 5, 2009
tags:

Internationalization is the process of designing applications so that they can be localized (adapted) to various languages and regions without engineering changes.

This word is commonly abbreviated to I18N by removing the 18 characters between the first character (I) and last character (n) of the word.

Internationalized References to Resources

Instead of hard coding application text intermingled among logic code, internationalized code obtain translated strings and objects using a key that is in every localized resource file. In each resource file is the text that goes with each key. Applications obtain text to a different language simply by looking in a different resource file.

A Java program references either resource bundle files containing key-value pairs in external files or in a ResourceBundle class file loaded into RAM.

Sun’s Using J2SE Internationalization APIs in J2EE Applications

With Microsoft .NET Framework Visual Basic and C# applications, each culture references a separate Satellite Assembly .resources file assembled as DLLs from .resx files after being signed with strong names.

The actual string or object that gets loaded depends on the current user interface Thread.CultureInfo.currentUIculture property for each thread.

So, unlike Java, .NET applications need to start again after every switch in culture. Bummer, I know.

[STAThreadAttribute]

static void Main()

{

Application.Run(new UICulture());

}

For VC++ in Microsoft Visual Studio 6.0, add compiler directives #ifdef and #ifndef to define the logic so different resource files are used when creating executables for different languages.

Mozilla source code stores cross-platform localizable strings in the file include/allxpstr.h. Message ID’s within this file are organized into sections. Obtain a message from this file with #include “xpgetstr.h” that provides function XP_GetString(MESSAGE_ID) that returns a pointer to a global buffer containing the human readable string. Use XP_GetStringForHTML(MESSAGE_ID, CharSetID, EnglishMessage) for HTML text.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: