harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Gorr" <vvg...@gmail.com>
Subject [drlvm] proposals for VM internationalization
Date Thu, 13 Jul 2006 06:08:36 GMT
Hi Harmony community.



I'd like to discuss with you a design for the VM native code
internationalization (attached below).

We'd like to consider this approach for the DRLVM first of all. However it
can be suitable for other parts of Harmony project I suppose.

Please let me know your opinions/objections.



Thanks,

Vladimir .



-----------------------------------------------------------------------------------------------------------------------------------

Internationalization design *1. Introduction*



The VM's output needs to be internationalized in order to provide localized
versions of our product.

The key idea is to use ResourceBundle class from apache log4cxx which allow
to store and effective use bundles with localized messages.

The document describes:

·         ResourceBundle naming conventions for bundles with localized
messages.

·         Structure of* *ResourceBundle file. "MessageId" (keys for
localized message in ResourceBundle) development guidelines.

·         Requirements.

·         How it works inside VM.



*Definitions: *



I18n – internationalization

L10n – localization

L7d – localized



*2. ResourceBundle naming conventions for bundles with localized messages. *



We offer to use ResourceBundle class from apache log4cxx as storage of
localized messages. At first time all Resourcebundles are files.

After VM starts, on VM's logging subsystem initialization stage, logging
system chooses appropriate set of ResourceBundles

according to values of environment variables: LC_ALL, LC_MESSAGES, and LANG.

Chosen ResourceBundles should be used for printing localized messages from
VM.



E.g. If the environment variable LANG is equal to "ru_RU" then the following
set of ResourceBundles should be used (see naming conventions below):

·         java_ru_RU.properties

·         java_ru.properties

·         java.properties



Each file which presents ResourceBundle class should have the following
name:

*java_language_country_variant.properties *where:



"_language" is a language e.g. "_ru" (Russian language). It may be empty.

"_country" is a country e.g. "_RU" (Russian federation ). It may be empty.

"_variant" is a variant. It may be empty.



            The main ResourceBundle file (with messages on English) should
be "java.properties".



*3. Structure of ResourceBundle file. "MessageId" development guidelines. *



The structure of ResourceBundle file should be the following:



MessageId1=localized message1

MessageId2=localized message2

….

Where:

MessageId{i} – ASCII string on English language. It should consist of vm's
subcomponent name ( e.g. init, port, gc.) and short description of message.

E.g. "init.help" is localized help message from "init" subcomponent of VM.

Localized message{i} – localized message.



Localized message can contain parameters. E.g. localized message pattern:
"This is message on English with two parameters: parameter number one – {0},


and parameter number two – {1}. We can print it again and in back order:
{1}, {0}".   For the first parameter is equal to integer value "1"

and the second is equal to string "two" the message for pattern above should
be:

"This is message on English with two parameters: parameter number one – 1,
and parameter number two – two. We can print it again and in back order:
two, 1".

*  *

*4. Requirements. *



   - All localized messages may be printed through apache log4cxx logger.

   - Parameters may be present in localized messages.
   - VM-I18N subsystem should automatically detect user's locale
   according to values of environment variables.
   - Minimize performance impact.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message