Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » I18N
I18N [message #459866] Thu, 07 December 2006 19:26 Go to next message
Eclipse UserFriend
Originally posted by: partyhut.internode.on.net

Hi all,

Can anybody tell me how to use Locale object with the Messages.java
generated by ECLIPSE? I read the I18N tut on java.sun.com. But couldn't
figure out how to put them together.... Below is the Messages.java class

package com.example.view;

import org.eclipse.osgi.util.NLS;

public class Messages extends NLS
{
private static final String BUNDLE_NAME =
"au.com.pulse.jpilot.view.messages"; //$NON-NLS-1$

public static String FavoritesTab;

public static String MainMenu;

public static String Menu;

public static String PulseScreenTitle;

public static String ToWorkBench;

public static String MainWorkPanel_DoubleClick;

public static String MainWorkPanel_UserMaintTabName;
static
{
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}

private Messages()
{
}
}

Cheers
HS
Re: I18N [message #459867 is a reply to message #459866] Thu, 07 December 2006 20:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: partyhut.internode.on.net

Also, I'd like to provide a login screen. A user can select the language
he/she want to use. I noticed the eclipse way of I18N initialize
everything before show the application GUI... how can I popup the login
screen then init all messages?

Cheers

HS wrote:
> Hi all,
>
> Can anybody tell me how to use Locale object with the Messages.java
> generated by ECLIPSE? I read the I18N tut on java.sun.com. But couldn't
> figure out how to put them together.... Below is the Messages.java class
>
> package com.example.view;
>
> import org.eclipse.osgi.util.NLS;
>
> public class Messages extends NLS
> {
> private static final String BUNDLE_NAME =
> "au.com.pulse.jpilot.view.messages"; //$NON-NLS-1$
>
> public static String FavoritesTab;
>
> public static String MainMenu;
>
> public static String Menu;
>
> public static String PulseScreenTitle;
>
> public static String ToWorkBench;
>
> public static String MainWorkPanel_DoubleClick;
>
> public static String MainWorkPanel_UserMaintTabName;
> static
> {
> // initialize resource bundle
> NLS.initializeMessages(BUNDLE_NAME, Messages.class);
> }
>
> private Messages()
> {
> }
> }
>
> Cheers
> HS
Re: I18N [message #459873 is a reply to message #459866] Thu, 07 December 2006 22:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: partyhut.internode.on.net

Now I understand the above code use the user's operating system setting
as default to create correct ResouceBoundle... Is there anyway I can let
a user to select the language he/she want to use?

HS wrote:
> Hi all,
>
> Can anybody tell me how to use Locale object with the Messages.java
> generated by ECLIPSE? I read the I18N tut on java.sun.com. But couldn't
> figure out how to put them together.... Below is the Messages.java class
>
> package com.example.view;
>
> import org.eclipse.osgi.util.NLS;
>
> public class Messages extends NLS
> {
> private static final String BUNDLE_NAME =
> "au.com.pulse.jpilot.view.messages"; //$NON-NLS-1$
>
> public static String FavoritesTab;
>
> public static String MainMenu;
>
> public static String Menu;
>
> public static String PulseScreenTitle;
>
> public static String ToWorkBench;
>
> public static String MainWorkPanel_DoubleClick;
>
> public static String MainWorkPanel_UserMaintTabName;
> static
> {
> // initialize resource bundle
> NLS.initializeMessages(BUNDLE_NAME, Messages.class);
> }
>
> private Messages()
> {
> }
> }
>
> Cheers
> HS
Re: I18N [message #459887 is a reply to message #459873] Fri, 08 December 2006 05:13 Go to previous messageGo to next message
Eclipse UserFriend
You can specify which locale to use with the -nl on the command line when starting Eclipse, if you don't want it to be the system default. I don't believe that you'll find it easy to change this with a dialog during startup easily, but if you do, it will be a case of setting the system property "osgi.nl" to the locale value.

Of course, you need to get in early since the messages are resolved when a bundle starts; so anything started before you set this property may have the wrong language. You could, of course, provide your own dialog box started from your own launcher to do the work for you, and then construct the appropriate launch mechanism.

Alex.

http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/misc/runtime-options.html
Re: I18N [message #459905 is a reply to message #459873] Fri, 08 December 2006 10:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom.seidel.spiritlink.de

HS schrieb:
> Now I understand the above code use the user's operating system setting
> as default to create correct ResouceBoundle... Is there anyway I can let
> a user to select the language he/she want to use?
>
> HS wrote:
>> Hi all,
>>
>> Can anybody tell me how to use Locale object with the Messages.java
>> generated by ECLIPSE? I read the I18N tut on java.sun.com. But
>> couldn't figure out how to put them together.... Below is the
>> Messages.java class
>>
>> package com.example.view;
>>
>> import org.eclipse.osgi.util.NLS;
>>
>> public class Messages extends NLS
>> {
>> private static final String BUNDLE_NAME =
>> "au.com.pulse.jpilot.view.messages"; //$NON-NLS-1$
>>
>> public static String FavoritesTab;
>>
>> public static String MainMenu;
>>
>> public static String Menu;
>>
>> public static String PulseScreenTitle;
>>
>> public static String ToWorkBench;
>>
>> public static String MainWorkPanel_DoubleClick;
>>
>> public static String MainWorkPanel_UserMaintTabName;
>> static
>> {
>> // initialize resource bundle
>> NLS.initializeMessages(BUNDLE_NAME, Messages.class);
>> }
>>
>> private Messages()
>> {
>> }
>> }
>>
>> Cheers
>> HS
One possibility is to update the config.ini with the osgi.nl property.
After you have set the property you can set a persistance flag and
relaunch the workbench. On the restart you ask for the flag and skip the
login-dialog.

--
Cheerz,
Tom
Thank you Alex and Tom!!! I will try them. [message #459993 is a reply to message #459873] Sun, 10 December 2006 17:37 Go to previous message
Eclipse UserFriend
Originally posted by: partyhut.internode.on.net

HS wrote:
> Now I understand the above code use the user's operating system setting
> as default to create correct ResouceBoundle... Is there anyway I can let
> a user to select the language he/she want to use?
>
> HS wrote:
>> Hi all,
>>
>> Can anybody tell me how to use Locale object with the Messages.java
>> generated by ECLIPSE? I read the I18N tut on java.sun.com. But
>> couldn't figure out how to put them together.... Below is the
>> Messages.java class
>>
>> package com.example.view;
>>
>> import org.eclipse.osgi.util.NLS;
>>
>> public class Messages extends NLS
>> {
>> private static final String BUNDLE_NAME =
>> "au.com.pulse.jpilot.view.messages"; //$NON-NLS-1$
>>
>> public static String FavoritesTab;
>>
>> public static String MainMenu;
>>
>> public static String Menu;
>>
>> public static String PulseScreenTitle;
>>
>> public static String ToWorkBench;
>>
>> public static String MainWorkPanel_DoubleClick;
>>
>> public static String MainWorkPanel_UserMaintTabName;
>> static
>> {
>> // initialize resource bundle
>> NLS.initializeMessages(BUNDLE_NAME, Messages.class);
>> }
>>
>> private Messages()
>> {
>> }
>> }
>>
>> Cheers
>> HS
Previous Topic:View Part Size
Next Topic:any way to hook the EditorManager on app startup?
Goto Forum:
  


Current Time: Fri Mar 21 17:35:02 EDT 2025

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

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

Back to the top