1

I've got short question about using Fragments in Eclipse RCP. Currently I'm using the Messages-mechanism to translate my strings. The Messages.java and the *.properties files are located in my Plugin and everything is working fine. Now I'd like to use different Strings/Translations for different customers. As far as I know Plugin-Fragments are a possible solution here. I've read that it's not possible to override files in a host plugin using a fragment. So I think I've to use 2 different fragments which provide the correct *.properties file. The following image shows the schema I think I must use.

Host-Fragment-Usage

After configuring the fragment projects (the host-plugins are set and the *.properties files are in a equally named package to the one in the host) I'd like to start my RCP Application via Eclipse IDE. The 2 Run Configurations are configured, too. When using the OSGI console I see that my fragment is present and RESOLVED.

But my problem is that the provided strings/translations from the fragments are not used. Each time I start the Application some old Strings/Translations are used (the one that were used before moving the property-Files to the fragments).

Does someone have any idea what I'm doing wrong and if my solution is the right approach?

Thanks in advance :)

AnarchoEnte
  • 558
  • 4
  • 20
  • i'm not sure but it looks like you're using two identical fragments - maybe it's just copy&paste but you can't provide two de-language packs (Deutschland) in two fragments.... – Martin Frank Dec 08 '15 at 07:54
  • you normally create a fragment for german language support and another fragment for (maybe) italian language support... – Martin Frank Dec 08 '15 at 07:55
  • I created both plugins via the New Wizard - no copy&paste. I have 2 different Products and 2 different Run Configuration. Depending on the Configuration I add Fragment1 OR Fragment2 - not both at the same time. Each Product should have its own messages.properties and german translation. The host plugin itself does not provide any messages.properties or german translation. – AnarchoEnte Dec 08 '15 at 07:59
  • sounds reasonable - you have two products that have different configuration... that's what fragments are for!... so your problem is that neither fragment1 nor fragment2 is used in any configuration? – Martin Frank Dec 08 '15 at 08:01
  • Yes, the fragments are not used, even if they are present when taking a look at the OSGI console: 31 ACTIVE _2.0.0.qualifier Fragments=32 32 RESOLVED _2.0.0.qualifier Master=31 – AnarchoEnte Dec 08 '15 at 11:39

2 Answers2

0

you have to run the eclipse product with the proper configuration - if you want to see (and test) your language support you have to start eclipse with the proper information!! enter image description here

try to set the language directly

-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl de_DE -consoleLog

Martin Frank
  • 3,445
  • 1
  • 27
  • 47
  • Unfortunately this doesn't work neither. I wonder that these Strings/Translations are used that were placed in host-plugin before I moved them to fragments. Even if I change the properties in my fragments the strings are not used. Maybe Eclipse uses some caching mechanism? – AnarchoEnte Dec 08 '15 at 11:33
  • if you start the eclipse application, do you see what content is installed? Help -> About -> Installation Details -> Plugins? your Fragment should be listed there... – Martin Frank Dec 08 '15 at 11:50
  • The Host-Plugin and the fragment are installed – AnarchoEnte Dec 08 '15 at 11:53
  • can you show how your Messages.java looks like? maybe the problem is within there – Martin Frank Dec 08 '15 at 11:56
  • import org.eclipse.osgi.util.NLS; public class Messages extends NLS { private static final String BUNDLE_NAME = ".ui.internal.messages"; //$NON-NLS-1$ public static String LoginAgent_LoginServerNotAvaliabeErrorText1; public static String ... ; static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); } private Messages() { } } – AnarchoEnte Dec 08 '15 at 12:08
  • that Messages.java is ok! ok, i'm out, sorry i can't provide more help :-$ – Martin Frank Dec 08 '15 at 12:11
0

Do you provide the header the manifest?

Bundle-Localization: plugin
Peter Kirschner
  • 927
  • 1
  • 9
  • 17
  • I've added this to my fragment Manifest.MF but without success :( The fragment is in status "RESOLVED" and has a link to my host-plugin, which is in status "ACTIVE". I think the connection is fine, but the messages provided in the fragment are not used. Maybe Eclipse caches some data? The messages which are used were moved (!) from the host to the fragment and changed. But the old messages are still used – AnarchoEnte Dec 10 '15 at 07:53
  • It must be inside the host. Not in the Fragment. – Peter Kirschner Dec 10 '15 at 08:36
  • Unfortunately no success. I begin to ask myself if it's possible to add the messages.properties via fragment to the host plugin. But IMHO this should be possible via fragments. The properties - Files are located inside a package named equally to the one in the host plugin. – AnarchoEnte Dec 10 '15 at 08:53
  • Have you tried the process described [here](http://www.vogella.com/tutorials/EclipseInternationalization/article.html)? It is definitely possible to do it. – Peter Kirschner Dec 10 '15 at 17:55