Difference between revisions of "Internationalization"

From Developer Documents
Jump to navigation Jump to search
m (Created page with '= Definitions = From [http://en.wikipedia.org/wiki/Internationalization_and_localization Wikipedia]: <blockquote> In computing, internationalization and localization are means o...')
 
Line 106: Line 106:
  
 
= Links =
 
= Links =
* Ticket: [https://www.simulationsite.net/trac/simantics/ticket/148]
+
* Ticket: [https://www.simantics.org/redmine/issues/148]
 
* [http://java.sun.com/javase/6/docs/api/java/util/Properties.html Java Properties class API]
 
* [http://java.sun.com/javase/6/docs/api/java/util/Properties.html Java Properties class API]
 
* [http://mindprod.com/jgloss/properties.html More verbose description of java property files]
 
* [http://mindprod.com/jgloss/properties.html More verbose description of java property files]
 
* [http://www.eclipse.org/articles/Article-Internationalization/how2I18n.html How to Internationalize your Eclipse Plug-In]
 
* [http://www.eclipse.org/articles/Article-Internationalization/how2I18n.html How to Internationalize your Eclipse Plug-In]
 
* [http://www-01.ibm.com/software/globalization/icu/index.jsp The International Component for Unicode (ICU)] Plugin that contains all IBM's internalization expertize.
 
* [http://www-01.ibm.com/software/globalization/icu/index.jsp The International Component for Unicode (ICU)] Plugin that contains all IBM's internalization expertize.

Revision as of 08:37, 28 October 2010

Definitions

From Wikipedia:

In computing, internationalization and localization are means of adapting computer software to different languages and regional differences.

  • Internationalization (i18n) is the process of designing a software application so that it can be adapted to various languages and regions without engineering changes.
  • Localization (l10n) is the process of adapting internationalized software for a specific region or language by adding locale-specific components and translating text.

Some companies, like Microsoft, IBM and Sun Microsystems, use the term globalization for the combination of internationalization and localization.[2][3] Globalization can also be abbreviated to g11n. This term is also known as NLS (National Language Support or Native Language Support).

To support this, all textual content that is used to produce textual output to the user must be translatable.

Current practices for internationalization

  • Java
    • Write all strings used to produce user-visible output in standard style property files, one for each language
    • String-generation happens by combining values from property files, no string data is coded directly into java source code.
  • Eclipse
    • Eclipse provides an NLS glue mechanism on top of property files. The NLS system automatically loads the contents of the property files into static Strings into Message classes. UI support is available for performing this internationalization.
    • The idea in Eclipse is to put different languages into plug-in fragments. Putting each language in separate fragments for each plug-in will however produce massive amounts of fragments. Probably a better idea is to put groups of languages in one fragment, thus forming a sort of 'language pack'.

Extent of internationalization in Simantics

Where?

It really hard to say anything else about this except that it completely depends on the domain of modelling where localization is needed and where it isn't. There generally no point in localizing "all String-type data in the database".

How?

Read #Ontology for internationalization for one possible implementation.

Localization of string values

Analogous to this example: <source lang="xml"> <library>

 <book>
   <name xml:lang="en">Shady</name>
   <name xml:lang="fi">Hämärä</name>
 </book>

</library> </source>

Ontology for internationalization

Scenarios

Name localization

  • Localization Larry needs to localize object names in his database. He wants the general language of the system to be configurable through user preferences. Objects and their data should be shown to the user in the preferred language if available.

Modelling localized names

Example graph:

L0 = <http://www.simantics.org/Layer0-1.0>
I18N = <http://www.simantics.org/I18N-1.0>

I18N.Component <T L0.Entity

I18N.HasLocalizedName <R L0.HasProperty
    L0.HasRange L0.String

I18N.LocalizedName <T L0.Entity
    [I18N.HasLocalization card "*"]

I18N.HasLocalization <R L0.HasProperty
    L0.HasDescription "Relations inherited from this identify a string in a certain locale"
    L0.HasRange L0.String

I18N.fi <R I18N.HasLocalization
    // Add locale-specific meta-data here
I18N.en <R I18N.HasLocalization
    // Add locale-specific meta-data here

I18N.Components : L0.Library
    L0.ConsistsOf
        I18N.Pipe : Component
            I18N.HasLocalizedName _ : I18N.LocalizedName
                fi "Pipe" : L0.String
                en "Putki" : L0.String             

Using localized names

The client programmer wants to convert all his Components into the correct localized names depending on his selected locale. In Simantics, resource names are primarily retrieved using the adaption mechanism of the DB graph interfaces:

interface ReadGraph {
    ...
    <T> T adapt(Resource resource, Class<T> clazz) throws AdaptionException, ValidationException, ServiceException;
    ...
}

by invoking:

    String getName(ReadGraph graph, Resource r) {
        return graph.adapt(r, String.class);
    }

The following can be done to enable this:

  • Create a code that takes a user selected locale and a LocalizedName instance as an argument and returns the string matching the specified locale.
  • Create a resource adapter for class java.lang.String for Component instances. See Resource Adaptation for help.
    • The resource adapter implementation should primarily look for a HasLocalizedName relation and then invoke the (:LocalizedName, Locale) -> java.lang.String converter.

Connection to Eclipse practices

TODO: ...

Links