Where is localization performed in Eclipse code?

I have an extended view in an Eclipse RCP application. This view has the localized name% view.name, with translation in the plugin.properties file to "My View Part".

I am studying Eclipse source code to understand how internationalization works. So far, I have not been able to find at what point the value from the properties file is read and assigned as the name of the view.

If I start with the resource reading part, I can see that the ManifestLocalization class reads the properties file, but I cannot find where it is used.

If I start by assigning a name, I see that the TableReader class gets the name of the view part, but it is already localized. I also saw that Eclipse converts this plugin.xml into some serialized object at some point. Maybe this was done for performance reasons?

So my question is, at what point does the string "% view.name" convert to "My View Part"

+3
source share
2 answers

There are at least two localization support mechanisms in eclipse: NLS and org.eclipse.core.runtime.registry.IConfigurationElement. The part that interests you occurs in IConfigurationElement.

IConfigurationElement.getAttribute(String key), ResourceTranslator.getResourceString() Bundle-Localization OSGi ( plugin${locale}.properties) .

, plugin.xml, getAttributeAsIs(String key).

+3

Eclipse, , ResourceTranslator.getResourceString(Bundle, String, ResourceBundle)

, ExtensionRegistry.addContribution().

, . , , , . , .

0

Source: https://habr.com/ru/post/1705239/


All Articles