Bug 288860 - Prepare JavaLite perspective (and views) for localization (i.e. translation)
Summary: Prepare JavaLite perspective (and views) for localization (i.e. translation)
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: IDE4EDU (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: bugday, helpwanted
Depends on:
Blocks:
 
Reported: 2009-09-08 15:08 EDT by Wayne Beaton CLA
Modified: 2014-01-09 15:38 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wayne Beaton CLA 2009-09-08 15:08:08 EDT
Prepare the project for translation into other languages using Babel (http://www.eclipse.org/babel). Note that preparation for translation and actually providing the translated strings are two different activities.

See the Babel Pseudo Translation Test (Bug 217339)
Comment 1 Cory Matheson CLA 2010-02-16 03:54:38 EST
I'm just curious... what is involved with this? I understand how localization works... But i haven't done anything or heard of Babel before.

Do we have to write our own string accessor class / localization storage / etc, or does the Babel project provide some API and/or tools for this?
Comment 2 Wayne Beaton CLA 2010-02-16 15:10:19 EST
The first step is to "externalize" the strings. That is, remove those strings that are intended for human consumption out of the code. You can do this with the "Source > Externalize Strings..." menu. This will change the Java code to make calls to a Messages class that will find the appropriate value in the appropriate language for a string. The strings themselves will be externalized into a properties file. 

Note that not all strings should be externalized. Identifiers, like those for plug-ins, should not be externalized. As a rule of thumb, only externalize those strings that the user sees.

While we're at it, it's also important to be careful about the kinds of strings you create in your code. Manually concatenating strings together, along the lines of:

String greeting = "hello " + name + ", I hope that you're having a pleasant day";

are problematic when it comes to translation. It's better to put it all into one string and use substitutions:

String greeting = String.format("hello %1$s, I hope that you're having a pleasant day", name);

This way, the single string has context around it which will help translators to understand what they're doing. In this example, for example, the word "hello" is a separate string and may have different translations based on the context in which it is used. This may be a bad example, but the principle holds.

Using the substitution technique also allows a translation to reorder substitutions based on grammar differences between languages.

HTH