Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Selecting the message.properties files which should be used
Selecting the message.properties files which should be used [message #329205] Mon, 16 June 2008 16:57 Go to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Hello,

I have a program which is used by two different departments. They want to
label the fields in the application differently.

This this I have created different message.properties files, e.g.

message.properties
message_app1.properties
message_app2.properties

I would like to select the correct property files via a startup parameter.
Is this possible and if how?

Best regards, Lars
Re: Selecting the message.properties files which should be used [message #329209 is a reply to message #329205] Mon, 16 June 2008 17:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Is this a question about developing Eclipse plugins, or is this a
straight standard Java application question? This newsgroup is for
Eclipse related questions.

Lars Vogel wrote:
> Hello,
>
> I have a program which is used by two different departments. They want to
> label the fields in the application differently.
>
> This this I have created different message.properties files, e.g.
>
> message.properties
> message_app1.properties
> message_app2.properties
>
> I would like to select the correct property files via a startup parameter.
> Is this possible and if how?
>
> Best regards, Lars
>
>

--
Thanks,
Rich Kulp
Re: Selecting the message.properties files which should be used [message #329211 is a reply to message #329209] Mon, 16 June 2008 17:47 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
I think he is searching for the -nl command line option but I'm not sure
about the following things:
- NLS supports a 3 application specific suffix
- One can leave out the first 2 parts

My wild guess would be that they have to be named:
message_de_DE_app1.properties and then one can use -nl de_DE_app1 when
starting up eclipse but I'm not sure about it.

Tom

Rich Kulp schrieb:
> Is this a question about developing Eclipse plugins, or is this a
> straight standard Java application question? This newsgroup is for
> Eclipse related questions.
>
> Lars Vogel wrote:
>> Hello,
>>
>> I have a program which is used by two different departments. They want
>> to label the fields in the application differently.
>>
>> This this I have created different message.properties files, e.g.
>>
>> message.properties
>> message_app1.properties
>> message_app2.properties
>>
>> I would like to select the correct property files via a startup
>> parameter. Is this possible and if how?
>>
>> Best regards, Lars
>>
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Selecting the message.properties files which should be used [message #329213 is a reply to message #329209] Mon, 16 June 2008 17:52 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

The question is related to eclipse plug-ins and the mechnismus to select
message.properties files in Eclipse plug-in development.

"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
news:g368gd$9te$1@build.eclipse.org...
> Is this a question about developing Eclipse plugins, or is this a straight
> standard Java application question? This newsgroup is for Eclipse related
> questions.
>
> Lars Vogel wrote:
>> Hello,
>>
>> I have a program which is used by two different departments. They want to
>> label the fields in the application differently.
>>
>> This this I have created different message.properties files, e.g.
>>
>> message.properties
>> message_app1.properties
>> message_app2.properties
>>
>> I would like to select the correct property files via a startup
>> parameter. Is this possible and if how?
>>
>> Best regards, Lars
>
> --
> Thanks,
> Rich Kulp
Re: Selecting the message.properties files which should be used [message #329217 is a reply to message #329211] Mon, 16 June 2008 19:07 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Hi Tom,

cool, I didn't know about the -nl option. This should solve my problem.

Hm... any idea what to use to get this parameter? The documentation tells me
to use
BootLoader.getNL();

but this class is @deprecated and no longer relevant according to the source
code.

Best regards, Lars




Best regards, Lars
"Tom Schindl" <tom.schindl@bestsolution.at> wrote in message
news:g368vq$hv7$1@build.eclipse.org...
>I think he is searching for the -nl command line option but I'm not sure
>about the following things:
> - NLS supports a 3 application specific suffix
> - One can leave out the first 2 parts
>
> My wild guess would be that they have to be named:
> message_de_DE_app1.properties and then one can use -nl de_DE_app1 when
> starting up eclipse but I'm not sure about it.
>
> Tom
>
> Rich Kulp schrieb:
>> Is this a question about developing Eclipse plugins, or is this a
>> straight standard Java application question? This newsgroup is for
>> Eclipse related questions.
>>
>> Lars Vogel wrote:
>>> Hello,
>>>
>>> I have a program which is used by two different departments. They want
>>> to label the fields in the application differently.
>>>
>>> This this I have created different message.properties files, e.g.
>>>
>>> message.properties
>>> message_app1.properties
>>> message_app2.properties
>>>
>>> I would like to select the correct property files via a startup
>>> parameter. Is this possible and if how?
>>>
>>> Best regards, Lars
>>>
>>
>
>
> --
> B e s t S o l u t i o n . at
> ------------------------------------------------------------ --------
> Tom Schindl JFace-Committer
> ------------------------------------------------------------ --------
Re: Selecting the message.properties files which should be used [message #329219 is a reply to message #329217] Mon, 16 June 2008 19:26 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Hi Tom,

I found it: Locale.getDefault().toString(); returns the passed parameter.
I can now read the correct properties via the following:

private static final String BUNDLE_NAME = "messages.messages_";

String nl = Locale.getDefault().toString();

NLS.initializeMessages(BUNDLE_NAME + nl, MessagesEclipse.class);

Thank you again, the -nl was extremely helpful. For the incorrect
documentation I opened a bug report.

Best regards, Lars



"Lars Vogel" <Lars.Vogel@gmail.com> wrote in message
news:g36dmd$ase$1@build.eclipse.org...
> Hi Tom,
>
> cool, I didn't know about the -nl option. This should solve my problem.
>
> Hm... any idea what to use to get this parameter? The documentation tells
> me to use
> BootLoader.getNL();
>
> but this class is @deprecated and no longer relevant according to the
> source code.
>
> Best regards, Lars
>
>
>
>
> Best regards, Lars
> "Tom Schindl" <tom.schindl@bestsolution.at> wrote in message
> news:g368vq$hv7$1@build.eclipse.org...
>>I think he is searching for the -nl command line option but I'm not sure
>>about the following things:
>> - NLS supports a 3 application specific suffix
>> - One can leave out the first 2 parts
>>
>> My wild guess would be that they have to be named:
>> message_de_DE_app1.properties and then one can use -nl de_DE_app1 when
>> starting up eclipse but I'm not sure about it.
>>
>> Tom
>>
>> Rich Kulp schrieb:
>>> Is this a question about developing Eclipse plugins, or is this a
>>> straight standard Java application question? This newsgroup is for
>>> Eclipse related questions.
>>>
>>> Lars Vogel wrote:
>>>> Hello,
>>>>
>>>> I have a program which is used by two different departments. They want
>>>> to label the fields in the application differently.
>>>>
>>>> This this I have created different message.properties files, e.g.
>>>>
>>>> message.properties
>>>> message_app1.properties
>>>> message_app2.properties
>>>>
>>>> I would like to select the correct property files via a startup
>>>> parameter. Is this possible and if how?
>>>>
>>>> Best regards, Lars
>>>>
>>>
>>
>>
>> --
>> B e s t S o l u t i o n . at
>> ------------------------------------------------------------ --------
>> Tom Schindl JFace-Committer
>> ------------------------------------------------------------ --------
>
>
Re: Selecting the message.properties files which should be used [message #329221 is a reply to message #329219] Mon, 16 June 2008 19:39 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Lars Vogel schrieb:
> Hi Tom,
>
> I found it: Locale.getDefault().toString(); returns the passed parameter.
> I can now read the correct properties via the following:
>
> private static final String BUNDLE_NAME = "messages.messages_";
>
> String nl = Locale.getDefault().toString();
>
> NLS.initializeMessages(BUNDLE_NAME + nl, MessagesEclipse.class);
>

Hm. Isn't

NLS.initializeMessages(BUNDLE_NAME, MessagesEclipse.class);

enough?

It looks to me NLS#buildVariants() should be enough if you fully qualify
your bundlenames.

So you should have:
message.properties => English
message_de.properties => German
message_de_DE_app1.properties => German special1
message_de_DE_app2.properties => German special2

You could of course leave out message_de.properties and directly write
your german strings to message.properties. You current approach missuses
Locales as far as I could see.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Selecting the message.properties files which should be used [message #329250 is a reply to message #329221] Tue, 17 June 2008 13:36 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Hi Tom,

true this should also work. I'll give it a try.

Thank you again.

Best regards, Lars
Re: Selecting the message.properties files which should be used [message #329267 is a reply to message #329221] Tue, 17 June 2008 18:07 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Hi Tom,

yes works automatically.

Cool. Thank you again, Lars

"Tom Schindl" <tom.schindl@bestsolution.at> wrote in message
news:g36fh6$cdr$1@build.eclipse.org...
> Lars Vogel schrieb:
>> Hi Tom,
>>
>> I found it: Locale.getDefault().toString(); returns the passed parameter.
>> I can now read the correct properties via the following:
>>
>> private static final String BUNDLE_NAME = "messages.messages_";
>>
>> String nl = Locale.getDefault().toString();
>>
>> NLS.initializeMessages(BUNDLE_NAME + nl, MessagesEclipse.class);
>>
>
> Hm. Isn't
>
> NLS.initializeMessages(BUNDLE_NAME, MessagesEclipse.class);
>
> enough?
>
> It looks to me NLS#buildVariants() should be enough if you fully qualify
> your bundlenames.
>
> So you should have:
> message.properties => English
> message_de.properties => German
> message_de_DE_app1.properties => German special1
> message_de_DE_app2.properties => German special2
>
> You could of course leave out message_de.properties and directly write
> your german strings to message.properties. You current approach missuses
> Locales as far as I could see.
>
> Tom
>
> --
> B e s t S o l u t i o n . at
> ------------------------------------------------------------ --------
> Tom Schindl JFace-Committer
> ------------------------------------------------------------ --------
Re: Selecting the message.properties files which should be used [message #329323 is a reply to message #329221] Wed, 18 June 2008 18:41 Go to previous message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Hi,

In case someone else is interested in the approach, I documented it here:
http://www.vogella.de/articles/RichClientPlatform/article.ht ml#externalizestrings

Best regards, Lars

"Tom Schindl" <tom.schindl@bestsolution.at> wrote in message
news:g36fh6$cdr$1@build.eclipse.org...
> Lars Vogel schrieb:
>> Hi Tom,
>>
>> I found it: Locale.getDefault().toString(); returns the passed parameter.
>> I can now read the correct properties via the following:
>>
>> private static final String BUNDLE_NAME = "messages.messages_";
>>
>> String nl = Locale.getDefault().toString();
>>
>> NLS.initializeMessages(BUNDLE_NAME + nl, MessagesEclipse.class);
>>
>
> Hm. Isn't
>
> NLS.initializeMessages(BUNDLE_NAME, MessagesEclipse.class);
>
> enough?
>
> It looks to me NLS#buildVariants() should be enough if you fully qualify
> your bundlenames.
>
> So you should have:
> message.properties => English
> message_de.properties => German
> message_de_DE_app1.properties => German special1
> message_de_DE_app2.properties => German special2
>
> You could of course leave out message_de.properties and directly write
> your german strings to message.properties. You current approach missuses
> Locales as far as I could see.
>
> Tom
>
> --
> B e s t S o l u t i o n . at
> ------------------------------------------------------------ --------
> Tom Schindl JFace-Committer
> ------------------------------------------------------------ --------
Previous Topic:Howto find out the ID of a View
Next Topic:How to get a list of sendto perspectives
Goto Forum:
  


Current Time: Fri Jul 19 14:20:40 GMT 2024

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

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

Back to the top