Selecting the message.properties files which should be used [message #329205] |
Mon, 16 June 2008 12:57  |
Eclipse User |
|
|
|
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 #329219 is a reply to message #329217] |
Mon, 16 June 2008 15:26   |
Eclipse User |
|
|
|
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 #329323 is a reply to message #329221] |
Wed, 18 June 2008 14:41  |
Eclipse User |
|
|
|
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
> ------------------------------------------------------------ --------
|
|
|
Powered by
FUDForum. Page generated in 0.03887 seconds