Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Internationalization
Internationalization [message #463299] Thu, 08 February 2007 06:33 Go to next message
Aravindhan Annamalai is currently offline Aravindhan AnnamalaiFriend
Messages: 89
Registered: July 2009
Location: Chennai
Member
Hi All,
we internationalized our application by externalizing the
strings(which resulted in the .properties file for every package), so we
created a fragment project which is having the same package structure as
of our main application... each package will contain the .properties file
for different languages(message_fr.properties-for French)...

1)we passed the run-time argument as -nl fr and it is working.
2)we want the users to select the language dynamically..so we are having
an option in our login dialog where they can select any language from the
combo box.
3)we are setting the Locale for the appropriate selection made by the user.
Locale.set default(Locale.French) or set property("osgi.nl","fr")

4)The predefined menus like help,about.... and prespective names are not
getting changed to the particular language..

so, how we can internationalize the perspective names and the pre-defined
menus dynamically.

Thanks
Aravind
Re: Internationalization [message #463422 is a reply to message #463299] Mon, 12 February 2007 08:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 11235813.despammed.com

Aravind schrieb:

[Internationalization]

> so, how we can internationalize the perspective names and the
> pre-defined menus dynamically.

Perspectives:

You know you can define strings used in the plugin.xml in the
plugin.properties file? E.g. "%perspective1.name" in the plugin.xml and
"perspective1.name = Perspective example name 1" in the
plugin.properties file. Then you can deliver a plugin.properties for
each language, e.g. plugin_fr.properties.

Pre-defined menus:

The predefined menus are not shown in your chosen language if you forgot
to deliver the corresponding language plugins for the Eclipse platform,
e.g. org.eclipse.core.runtime.nl1, org.eclipse.swt.nl1... (for each
package/feature you're using).


Regards,

Carmen
Re: Internationalization [message #463504 is a reply to message #463422] Mon, 12 February 2007 21:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 11235813.despammed.com

Carmen Smolne schrieb:

> Aravind schrieb:
>
> [Internationalization]
>
>> so, how we can internationalize the perspective names and the
>> pre-defined menus dynamically.
>

I'm sorry, I made a mistake. At the moment I couldn't find a possibility
to change the locale for the Eclipse part of a RCP application at
runtime without restarting the application. Maybe someone else knows a
solution.

Regards,

Carmen
Re: Internationalization [message #463514 is a reply to message #463504] Tue, 13 February 2007 06:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jayam.balasubramaniam.gmail.com

Is it possible to set the locale when we restart the application? if yes,
then where we should made the (locale)entry?

i tried this in my application
1) i made entry in config.ini file as
osgi.nl=fr
but my application is not getting changed. if i do the same in eclipse
config.ini file then the eclipse locale is getting changed.

so how we can change the locale?


Thanks,
Jayam
Re: Internationalization [message #463520 is a reply to message #463514] Tue, 13 February 2007 08:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 11235813.despammed.com

Jayam schrieb:

> Is it possible to set the locale when we restart the application? if
> yes, then where we should made the (locale)entry?

I've implemented it in my application with the config.ini in the sub
folder "configuration" of my RCP product and it is doing well.

> i tried this in my application
> 1) i made entry in config.ini file as
> osgi.nl=fr
> but my application is not getting changed. if i do the same in eclipse
> config.ini file then the eclipse locale is getting changed.

Did you try it in debug mode? Then maybe the config.ini is overwritten
every time you start a debug session (seems to be the default in the
xxx.product file). Try it with the exported product. Or you should enter
a more qualified value like fr_FR (language/country). I tried it with
de_DE and en_US and it was ok.

Regards

Carmen
Re: Internationalization [message #463521 is a reply to message #463520] Tue, 13 February 2007 09:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 11235813.despammed.com

Carmen Smolne schrieb:

> Did you try it in debug mode? Then maybe the config.ini is overwritten
> every time you start a debug session (seems to be the default in the
> xxx.product file).

I should have written 'did you try it from within the Eclipse IDE or as
a standalone application'...

Regards

Carmen
Re: Internationalization [message #463647 is a reply to message #463521] Wed, 14 February 2007 04:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jayam.balasubramaniam.gmail.com

Thanks Carmen! its working ,if i specify the locale in config.ini file the
product is getting changed to the corresponding language.

My another query... i want to set the locale dynamically ie i am having a
dialog displays the language in combo box,when user selete the language
the application should start in that language, how could we implement this?

And if we use IPlatformRunnable.EXIT_RESTART to restart the application it
is not restarting properly,so how we can restart the application?

Thanks,
Jayam
Re: Internationalization [message #463669 is a reply to message #463647] Wed, 14 February 2007 10:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 11235813.despammed.com

Jayam schrieb:
> My another query... i want to set the locale dynamically ie i am having
> a dialog displays the language in combo box,when user selete the
> language the application should start in that language, how could we
> implement this?

The only way I know is to change the osgi.nl entry in the config.ini via
code and then restart the application.

> And if we use IPlatformRunnable.EXIT_RESTART to restart the application
> it is not restarting properly,so how we can restart the application?

What do you mean by 'not restarting properly'? I have a preference page
on which the users can change the current locale. After changing the
entry in the config.ini and the value of the locale in the application
preference store (which I use for Locale.setDefault(...)), I do a
workbench.restart() at the end of the performOk() method of my
preference page class:

public class MyPreferencePage extends FieldEditorPreferencePage {
...

@Override
public boolean performOk() {
setLocaleInConfig();
setPropertyInPreferenceStore();
boolean result = super.performOk();
if (localeChanged)
workbench.restart();
return result;
}
}

The restart is performed by the class Application:

public class Application implements IPlatformRunnable {
...

public Object run(Object args) throws Exception {
Display display = PlatformUI.createDisplay();
try {
int returnCode = PlatformUI.createAndRunWorkbench(display,
new ApplicationWorkbenchAdvisor());
if (returnCode == PlatformUI.RETURN_RESTART) {
return IPlatformRunnable.EXIT_RESTART;
}
Platform.endSplash();
return IPlatformRunnable.EXIT_OK;
}
finally {
display.dispose();
}
}
}

Maybe this helps.

Regards,

Carmen
Re: Internationalization [message #463868 is a reply to message #463669] Mon, 19 February 2007 06:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jayam.balasubramanaim.gmail.com

Carmen wrote:
The only way I know is to change the osgi.nl entry in the config.ini via
code and then restart the application.

Jayam wrote:
When i try to access the config.ini file i am getting the following error:

D:\WorkSpace_Jayam\minttest\.metadata\.plugins\org.eclipse.p de.core\MYPRODUCT.product
(Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileWriter.<init>(Unknown Source)
at com.unisys.mint.Application.run(Application.java:59)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
!SESSION 2007-02-17 15:34:32.466
-----------------------------------------------

How i can access my config.ini file and entry the osgi.nl?

Thanks,
jayam
Re: Internationalization [message #463923 is a reply to message #463868] Tue, 20 February 2007 14:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 11235813.despammed.com

Jayam schrieb:

> When i try to access the config.ini file i am getting the following error:
> D:\WorkSpace_Jayam\minttest\.metadata\.plugins\org.eclipse.p de.core\MYPRODUCT.product
> (Access is denied)

In an exported product you'll find the file in the sub folder
'configuration' of your application folder. From within the IDE your
path above seems to be correct, but aren't you missing the file name? I
would have expected something like that:

D:\WorkSpace_Jayam\minttest\.metadata\.plugins\org.eclipse.p de.core\MYPRODUCT.product\config.ini

You find the correct folder with

System.getProperty("osgi.configuration.area")



Carmen
Re: Internationalization [message #467049 is a reply to message #463669] Fri, 27 April 2007 15:20 Go to previous message
Eclipse UserFriend
Originally posted by: maurice.rosenfeld.tuhh.de

Hi Carmen,

I'm facing the same problem as Jayam. Is it possible to get your full MyPreferencePage class? I think this would help me a lot...

Thanks in advance
Junior
Previous Topic:Configuration scope problems
Next Topic:Table viewer update problem
Goto Forum:
  


Current Time: Fri Apr 19 21:56:15 GMT 2024

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

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

Back to the top