Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » I18N problems
I18N problems [message #134545] Sun, 31 May 2009 03:59 Go to next message
lsq  is currently offline lsq Friend
Messages: 40
Registered: July 2009
Member
hi all,
I am new to RAP. I have encountered a problem when i am developing a
project using RAP.
I the I18N in this project by introducing a helper class which read
current local by calling RWT.getLocal method, and then invoke
getString(key) method on the ResourceBundle object through the locale
returned before. something like this:
public static String getMessage(String key) {
Locale currentLocale = RWT.getLocale();
ResourceBundle messages =
ResourceBundle.getBundle(BASE_PROPERTIES_NAME, currentLocale);
return messages != null ? messages.getString(key) : key;
}

Well, this method read property values accoring to the current local. As
the RAP applicaiton is prepared to support Chinese and English(default).
It is working well when using browser settings set for the two languages.
But when I switch to use a third language(e.g., Arabic), Chinse was
displayed , not English as espected. It seems that the default local of
JVM (Chinese)was used instead of the default property setting. I can fix
this problem by invoking Locale.setDefaultLocal(Local) by passing English
as the default local for jvm.


Another problem that confuses me very much is that as part of I18N work is
done in the Plugin.xml, by providing label of the extension points. The
default language of plugin.properties is also English. I find out that
from time to time two languages are displayed together, with Chinese from
project specific properties files and English from plugin.properties when
using Chinese as the default language of the Browser. Both of the
application specific properties files and plugin properties files have
been used for I18N for two languages:Chinese and English(default). The
problem I discribed above occurs from time to time, probablly because the
two mechenisms are different?
Re: I18N problems [message #134559 is a reply to message #134545] Sun, 31 May 2009 04:34 Go to previous messageGo to next message
lsq  is currently offline lsq Friend
Messages: 40
Registered: July 2009
Member
I try to overide the plugin.xml, by invoking e.g.,
IObjectActionDelegate.setActivePart(Action, Part) method, in this method I
try to read property values from application specific propertie files and
then invoke action.setText(String) method. something like this:

public void setActivePart(IAction action, IWorkbenchPart targetPart) {
this.part = targetPart;
action.setText(I18N.getMessage(SMACK.STARTCHAT_LABEL));
action.setImageDescriptor(AbstractUIPlugin.imageDescriptorFr omPlugin(
Activator.PLUGIN_ID, "icons/chat.png"));

}

But unfortunately , I still get the same problem, Chinese from application
specific property files and English from plugin.properties in one context
menu.with a browser language set to Chinese. Bye the way my machine local
is set to China/Chinese.
Could any guys here provide some general recommendations about I18N in
RAP, especially how to handle plugin.xml properties.
Re: I18N problems [message #134675 is a reply to message #134545] Tue, 02 June 2009 11:10 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
lsq wrote:
> hi all, I am new to RAP. I have encountered a problem when i am
> developing a project using RAP. I the I18N in this project by
> introducing a helper class which read current local by calling
> RWT.getLocal method, and then invoke getString(key) method on the
> ResourceBundle object through the locale returned before. something like
> this:
> public static String getMessage(String key) {
> Locale currentLocale = RWT.getLocale();
> ResourceBundle messages =
> ResourceBundle.getBundle(BASE_PROPERTIES_NAME, currentLocale);
> return messages != null ? messages.getString(key) : key;
> }
>
> Well, this method read property values accoring to the current local. As
> the RAP applicaiton is prepared to support Chinese and English(default).
> It is working well when using browser settings set for the two
> languages. But when I switch to use a third language(e.g., Arabic),
> Chinse was displayed , not English as espected. It seems that the
> default local of JVM (Chinese)was used instead of the default property
> setting. I can fix this problem by invoking
> Locale.setDefaultLocal(Local) by passing English as the default local
> for jvm.
I think this is intended behavior of the JRE. setDefaultLocale is
the way to specify the default locale. The JRE can't guess what
language is in the default properties file.

>
>
> Another problem that confuses me very much is that as part of I18N work
> is done in the Plugin.xml, by providing label of the extension points.
> The default language of plugin.properties is also English. I find out
> that from time to time two languages are displayed together, with
> Chinese from project specific properties files and English from
> plugin.properties when using Chinese as the default language of the
> Browser. Both of the application specific properties files and plugin
> properties files have been used for I18N for two languages:Chinese and
> English(default). The problem I discribed above occurs from time to
> time, probablly because the two mechenisms are different?

Are you experiencing the same as described in this bug?
277674: [NLS] objectContribution's in popupMenus left untranslated
after first switching of language
https://bugs.eclipse.org/bugs/show_bug.cgi?id=277674
Re: I18N problems [message #134688 is a reply to message #134559] Tue, 02 June 2009 11:10 Go to previous messageGo to next message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Hi,

maybe this helps:
http://dev.eclipse.org/newslists/news.eclipse.technology.rap /msg06474.html

Regards,
Stefan.

lsq schrieb:
> I try to overide the plugin.xml, by invoking e.g.,
> IObjectActionDelegate.setActivePart(Action, Part) method, in this method
> I try to read property values from application specific propertie files
> and then invoke action.setText(String) method. something like this:
>
> public void setActivePart(IAction action, IWorkbenchPart targetPart) {
> this.part = targetPart;
> action.setText(I18N.getMessage(SMACK.STARTCHAT_LABEL));
> action.setImageDescriptor(AbstractUIPlugin.imageDescriptorFr omPlugin(
> Activator.PLUGIN_ID, "icons/chat.png"));
> }
>
> But unfortunately , I still get the same problem, Chinese from
> application specific property files and English from plugin.properties
> in one context menu.with a browser language set to Chinese. Bye the way
> my machine local is set to China/Chinese.
> Could any guys here provide some general recommendations about I18N in
> RAP, especially how to handle plugin.xml properties.
>
Re: I18N problems [message #134895 is a reply to message #134688] Thu, 04 June 2009 12:14 Go to previous message
lsq  is currently offline lsq Friend
Messages: 40
Registered: July 2009
Member
Stefan Roeck wrote:

> Hi,

> maybe this helps:
> http://dev.eclipse.org/newslists/news.eclipse.technology.rap /msg06474.html

> Regards,
> Stefan.

> lsq schrieb:
>> I try to overide the plugin.xml, by invoking e.g.,
>> IObjectActionDelegate.setActivePart(Action, Part) method, in this method
>> I try to read property values from application specific propertie files
>> and then invoke action.setText(String) method. something like this:
>>
>> public void setActivePart(IAction action, IWorkbenchPart targetPart) {
>> this.part = targetPart;
>> action.setText(I18N.getMessage(SMACK.STARTCHAT_LABEL));
>> action.setImageDescriptor(AbstractUIPlugin.imageDescriptorFr omPlugin(
>> Activator.PLUGIN_ID, "icons/chat.png"));
>> }
>>
>> But unfortunately , I still get the same problem, Chinese from
>> application specific property files and English from plugin.properties
>> in one context menu.with a browser language set to Chinese. Bye the way
>> my machine local is set to China/Chinese.
>> Could any guys here provide some general recommendations about I18N in
>> RAP, especially how to handle plugin.xml properties.
>>
hi,
Thank you for your advice.What I have already done are as follows:
1.check out two projects into the workspace;
org.eclipse.equinox.registry as a source project (3.4.100)
org.eclipse.rap.equinox.registry as a source project
2. add these two projects to the configuration(bellow Workspace).
3. add Bundle-Localization: plugin' to the manifest.mf

And I start the application locally, I got strings from plugin.xml
internationlized. Except for popup menus added through objectContribution.
For the sake of clerity, I remove all the codes on action text in all
IObjectActionDelegate implementations.
It seems that these labels(on the popup menu) are pared statically, as
when I start two session in different browsers with different language
settings (Chinese & English), the first session takes priority over the
second, and the second takes whatever from the first session when display
a popup menu. This is not on changing the local manully, but about sequece
of sessions.It is ok things like ViewPart of EditorPart, but not for popup
menus in the plugin.xml.
Previous Topic:Graphics.getImage()
Next Topic:Error running BIRT report via Tomcat
Goto Forum:
  


Current Time: Tue Dec 07 01:08:54 GMT 2021

Powered by FUDForum. Page generated in 0.02299 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top