Hi, Vladimir

Log4c and log4cpp are both good tools, but if our requirements are just message internationalization, maybe log4cxx is overkill? After all, as a complete log framework, it provides supports to i18n, category, layout....

And if we talk about ResourceBundle only, I'd suggest consider ICU4C as a candidate, which provides many i18n features including ResourceBundle[1] support to c as well as c++, and more important, it has been included as Harmony dependencies.

Of course, if you think VM needs more complicated log mechanism support, this will be another story.

[1]http://icu.sourceforge.net/apiref/icu4c/

Vladimir Gorr wrote:
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.



--
Paulex Yang
China Software Development Lab
IBM



---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to