Bug 403305 - Internationalizing icons does not use client locale
Summary: Internationalizing icons does not use client locale
Status: ASSIGNED
Alias: None
Product: RAP
Classification: RT
Component: Workbench (show other bugs)
Version: 1.5   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-14 05:27 EDT by Markus Krüger CLA
Modified: 2013-04-09 05:00 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Krüger CLA 2013-03-14 05:27:35 EDT
In RCP it is possible to define icons for commandImages, view, and perspectives using the syntax "$nl$/icons/myimage.png" to localize images. Using this mechanism in RAP always uses the system/osgi locale instead of the client side locale.

Looking a bit deeper I found the code responsible for this in class "org.eclipse.core.internal.runtime.FindSupport" and static member "NL_JAR_VARIANTS". Since this is an equinox common plugin this seems to be not fixable there for RAP.

A possible solution for RAP would be to change the Methode "org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin(String, String)" to use the following code instead of "fullPathString = BundleUtility.find(bundle, imageFilePath)":

New Code:

Locale locale = RWT.getLocale();
HashMap<String, String> map = new HashMap<String, String>();
map.put("$nl$", locale.toString());
URL fullPathString = FileLocator.find(bundle, new Path(imageFilePath), map);

if (fullPathString == null) {
	// look for the image (this will check both the plugin and fragment
	// folders
	fullPathString = BundleUtility.find(bundle, imageFilePath);
	if (fullPathString == null) {
		try {
			fullPathString = new URL(imageFilePath);
		}
		catch (MalformedURLException e) {
			return null;
		}
	}
}

return ImageDescriptor.createFromURL(fullPathString);