Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » correct place for I18N classes
correct place for I18N classes [message #1411020] Fri, 22 August 2014 07:23 Go to next message
Ralf Heydenreich is currently offline Ralf HeydenreichFriend
Messages: 223
Registered: July 2009
Senior Member
Hi all,
I've a main project (plugin org.sample.rcp) which contains the Application.e4xmi and the l10n bundle files in OSGI-INF. Furthermore, I've a Messages class in this plugin which is used by the TranslationService. The org.sample.rcp uses another plugin (org.sample.resources) which contains some resources. These resources are managed by MyResourceService (an own OSGi service). This service needs the Messages class, too. But if I make a dependency to the main org.sample.rcp plugin I get a cyclic dependency, which is evil. Now, if I put the the OSGI-INF and the Messages class into a common plugin (which would be my preferred solution), the Application.e4xmi can't resolve the localized labels ("%my.sample.label" gets "!my.sample.label!"). How can I solve this? I don't want to put the Application.e4xmi into the common plugin because this is the wrong place (in my opinion).

TIA,
Ralf.
Re: correct place for I18N classes [message #1412111 is a reply to message #1411020] Mon, 25 August 2014 10:06 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2798
Registered: July 2012
Senior Member
The TranslationService is not using a Messages class, it uses the configured ResourceBundle, by default the bundle in OSGI-INF/l10n. You can customize that behavior by registering a custom ResourceBundleProvider as explained here [1]

At least if you are using Eclipse Luna.

If you are using the new Message Extension as explained in this blog post [2] you are able to configure the position of the bundle that should be used by the Messages class. This for example enables you to create the Messages class in a common bundle and leave the resource bundle in the bundle that contains the Application.e4xmi.

[1] http://stackoverflow.com/questions/21776496/eclipse-rcp-getting-resourcebundles-using-custom-resourcebundle-control/21808998#21808998
[2] http://blog.vogella.com/2013/05/22/eclipse-internationalization-part-24-new-message-extension-by-dirk-fauth-and-tom-schindl/
Re: correct place for I18N classes [message #1412670 is a reply to message #1412111] Tue, 26 August 2014 19:39 Go to previous message
Ralf Heydenreich is currently offline Ralf HeydenreichFriend
Messages: 223
Registered: July 2009
Senior Member
Am 25.08.2014 um 12:06 schrieb Dirk Fauth:
> [...]
> If you are using the new Message Extension as explained in this blog
> post [2] you are able to configure the position of the bundle that
> should be used by the Messages class. This for example enables you to
> create the Messages class in a common bundle and leave the resource
> bundle in the bundle that contains the Application.e4xmi.
>
> [1]
> http://stackoverflow.com/questions/21776496/eclipse-rcp-getting-resourcebundles-using-custom-resourcebundle-control/21808998#21808998
>
> [2]
> http://blog.vogella.com/2013/05/22/eclipse-internationalization-part-24-new-message-extension-by-dirk-fauth-and-tom-schindl/
>


Hi Dirk,
I use this approach and read it a few months ago. Since then I forgot
the @Messages annotation, because the Messages class and the OSGI-INF
were in the same plugin... Now it works perfect. Thanks!

Ralf.
Previous Topic:background-color and background-image
Next Topic:Invalid ToolItem state with "org.eclipse.ui.file.save"
Goto Forum:
  


Current Time: Tue Jan 19 19:30:16 GMT 2021

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

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

Back to the top