|BundleTranslationProvider usage [message #987048]
||Fri, 23 November 2012 03:06
| Dirk Fauth
Registered: July 2012
in Eclipse 3.x I used the approach to have one resource bundle per plugin instead of the one resource bundle per package like the "Externalize Strings" suggests. And I linked that resource bundle also in the MANIFEST.MF, so there is really only one resource bundle per plugin (for Eclipse resources and in code translation).
In Eclipse 4 there is the concept of the TranslationService. By using the BundleTranslationProvider and set the resource bundle to OSGI-INF/l10n this seems to be a similar approach or at least it could be used the same way. But there is one thing that seems to be strange looking at the BundleTranslationProvider.
I understand that the service needs to get the information out of which bundle it has to retrieve the translation. This is because the service is in application scope. Therefore the BundleTranslationProvider needs to search for the resource bundle on every translate() call. I'm not sure about the performance on searching files in the OSGi context, but IMHO this is odd. But I also don't have a solution on this.
Does the Eclipse Application Model also use the BundleTranslationProvider?
I could think of some solution to have a translation service per bundle, so you don't have to search the resource bundle everytime. But I'm not sure if this is a concept that is supported at the moment.
Of course I know that I can write my own service, but that would also be global. I can also keep the translations like before, but in fact I would need to write the same code for every plugin. I can also create a custom class that does nearly the same as the translation service and put it into the bundle context myself (which I am trying at the moment). I am just curious if this is also something that could be interesting in Eclipse 4 itself.
P.S. Sorry for the long text, just wanted to write down all my thoughts.
Powered by FUDForum
. Page generated in 0.02955 seconds