Contributed MenuItems don't get translated sometimes [message #1752814] |
Fri, 27 January 2017 10:23  |
Eclipse User |
|
|
|
Hello all,
currently I'm working on an Eclipse 4 RCP application. The application consists of multiple plugins which are localized with OSGI-INF/l10n/bundle.properties files.
One of these plugins' fragment.e4xmi contributes some menu items to the main menu bar which is controlled by another plugin. Those menu items are also nationalized.
However, on about half of the starts of my application, the contributed menu items would not translate and only show the translation identifier (something like %foo.bar). I've done some research with the model spy tool, which showed that sometimes the contributerUri is not set on the faulty menu items.
I'm not actually sure what causes the problem, especially the fact that it only occures on about half of the launches of the application seems unlogical to me.
I found this thread which describes a similar situation like mine but it seems that it is a different problem as the bug described in that thread was fixed a long time ago.
Does anyone have an idea what could be the problem? Could it be a bug in the Eclipse SDK?
Regards,
Nicolas
|
|
|
Re: Contributed MenuItems don't get translated sometimes [message #1754563 is a reply to message #1752814] |
Mon, 20 February 2017 05:35   |
Eclipse User |
|
|
|
Hi Nicolas,
I too am having issue trying to translate a "View Menu" tooltip on a View Menu of toolbar in an E4 Part. Also I can't seem to translate "Minimize" and "Maximize" text of an E4 Part even though I've added a Fragement, with Host of SWT and JFace plugins, but no translation seems to occur.
I'd be happy to hear any solutions on these translation issues myself.
All the best,
Marv,
Nicolas Abbuehl wrote on Fri, 27 January 2017 15:23Hello all,
currently I'm working on an Eclipse 4 RCP application. The application consists of multiple plugins which are localized with OSGI-INF/l10n/bundle.properties files.
One of these plugins' fragment.e4xmi contributes some menu items to the main menu bar which is controlled by another plugin. Those menu items are also nationalized.
However, on about half of the starts of my application, the contributed menu items would not translate and only show the translation identifier (something like %foo.bar). I've done some research with the model spy tool, which showed that sometimes the contributerUri is not set on the faulty menu items.
I'm not actually sure what causes the problem, especially the fact that it only occures on about half of the launches of the application seems unlogical to me.
I found this thread which describes a similar situation like mine but it seems that it is a different problem as the bug described in that thread was fixed a long time ago.
Does anyone have an idea what could be the problem? Could it be a bug in the Eclipse SDK?
Regards,
Nicolas
|
|
|
Re: Contributed MenuItems don't get translated sometimes [message #1754882 is a reply to message #1754563] |
Thu, 23 February 2017 08:50  |
Eclipse User |
|
|
|
Hi Marvin,
I did some further research and found out that, in my case, the problem is related to when the application starts and the application.e4xmi is loaded.
The contributorUri of the affected MenuItems is being saved correctly into that file, however when the application model is loaded from this file the Uri is either not read correctly from the file or not set to the MenuItem.
My workaround for that problem is to just set the contributorUri for the affected MenuItems manually on application startup. This is most likely not the best solution, but it works for now:
MTrimmedWindow trim = (MTrimmedWindow) modelService.find("your-window-id", application);
MMenu menu = (MMenu)modelService.find("your-menu-id", trim.getMainMenu());
if(menu != null) {
for(MMenuElement item : menu.getChildren()) {
if(item instanceof MHandledMenuItem && item.getElementId().contains("some-common-string-in-the-menuitem-id")) {
item.setContributorURI("platform:/plugin/com.example.yourcontributingplugin");
}
}
}
Hope that helps you.
Nicolas
|
|
|
Powered by
FUDForum. Page generated in 0.03145 seconds