Best practise for using Translation Service (Luna M6) [message #1318603] |
Sun, 27 April 2014 15:37  |
Eclipse User |
|
|
|
Hi all,
I'm looking for a practical way for the i18n of my application. I found
this blog post [1], but I think it could go easier. In my current
application (Eclipse 3.7 RCP) there I've a construction like this:
import static my.legacy.rcp.app.Translation._
....
(inside a method)
System.out.println(_("message.key"));
The "_" method is looking for the key and formats the message in the
right way.
I know that it's perhaps not the most optimal solution, but it worked
for now. If I want to use the TranslationService this construction fails
(or at least I don't know how to implement it), because there's no
static access to it. I want to use the "classic" way for my translation
files (OSGI-INF folder).
How could I get a similar solution in Eclipse 4 like the above mentioned?
Thanks in advance,
Ralf.
[1]
http://blog.vogella.com/2013/05/22/eclipse-internationalization-part-24-new-message-extension-by-dirk-fauth-and-tom-schindl/
|
|
|
|
|
Re: Best practise for using Translation Service (Luna M6) [message #1323447 is a reply to message #1322280] |
Wed, 30 April 2014 05:03  |
Eclipse User |
|
|
|
yes you need to maintain both
Tom
On 29.04.14 21:42, Ralf Heydenreich wrote:
> Am 27.04.2014 23:24, schrieb Tom Schindl:
>> The translation stuff in e4 uses methods instead of string literals
>> because this:
>> a) has less overhead from a memory point of view
>> b) is compiler checked
>>
>> So your code would look like this:
>>
>> @Inject
>> @Translation
>> Messages _;
>>
>> System.out.println(_.message_key());
>>
>> Tom
>>
>
> Ok, I get it. Does it really mean that I have to maintain TWO files?
> Then I have bundle_XX.properties and an accompanying Messages class
> file... This cries for a little generator...
>
> Greetz,
> Ralf.
>
|
|
|
Powered by
FUDForum. Page generated in 1.26754 seconds