Hi, as I didn't got any response on my mail, I created ticket and contributed via Gerrit. Maybe my explanation wasn't good enough, and code speaks louder than words. :)
https://git.eclipse.org/r/#/c/22159/ Curious on any feedback. Greez, Dirk On Mon, Feb 17, 2014 at 11:46 AM, Dirk Fauth <[email protected]> wrote: > Hi, > > on stackoverflow there was a question on how to modify the default > behaviour for loading ResourceBundles. The question was how to do that for > the application model and the new message extension aswell. > > > http://stackoverflow.com/questions/21776496/eclipse-rcp-getting-resourcebundles-using-custom-resourcebundle-control > > I showed a way by overriding the BundleLocalization to do a custom loading > instead of the default properties file based OSGi loading. > > https://github.com/fipro78/e4classbasedtranslation > > For this I also created a custom TranslationService, as the default > BundleTranslationProvider is getting the BundleLocalization by calling > ServicesActivator.getDefault().getLocalizationService() instead of getting > it injected. > > So there are some questions on the BundleTranslationProvider API: > > 1. Should it be possible for a user to simply extend the > BundleTranslationProvider? (it is located in an internal package) > 2. Should retrieving the BundleLocalization be modified to get injected > instead of calling the ServicesActivator? (not sure if this would have > impact in other cases) > 3. Should we modify the visibility of getBundle() to protected so it is > easier to extend? Or should this even be changed to use the > ResourceBundleHelper to avoid duplicated code? > > I think the BundleTranslationProvider could simply be changed to look like > this. > > @Inject > BundleLocalization localizationService; > > @Override > public String translate(String key, String contributorURI) { > if (localizationService == null) > return key; > > ResourceBundle resourceBundle = > ResourceBundleHelper.getResourceBundleForUri(contributorURI, > ResourceBundleHelper.toLocale(locale), > localizationService); > return getResourceString(key, resourceBundle); > } > > In that case it shouldn't be necessary to override it in most of the > cases. But I'm not sure if this would have any side effects. > > Because of the current development state, I wanted to ask about this first > on the mailing list, before I contribute a patch via Gerrit. Any feedback > is welcome! > > Greez, > Dirk >
_______________________________________________ e4-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/e4-dev
