Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Contributed MenuItems don't get translated sometimes(MenuItems contributed by a plugins' fragment.e4xmi don't get translated on half of the application launches)
Contributed MenuItems don't get translated sometimes [message #1752814] Fri, 27 January 2017 15:23 Go to next message
Nicolas Abbuehl is currently offline Nicolas AbbuehlFriend
Messages: 2
Registered: January 2017
Junior Member
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 10:35 Go to previous messageGo to next message
Marvin Stravinski is currently offline Marvin StravinskiFriend
Messages: 3
Registered: April 2016
Junior Member
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:23
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 #1754882 is a reply to message #1754563] Thu, 23 February 2017 13:50 Go to previous message
Nicolas Abbuehl is currently offline Nicolas AbbuehlFriend
Messages: 2
Registered: January 2017
Junior Member
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
Previous Topic:Dark Theme GTK working with KDE Plasma 5
Next Topic:What is replacement for ExecutionEvent parameter
Goto Forum:
  


Current Time: Fri Apr 19 01:29:42 GMT 2024

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

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

Back to the top