Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mat-dev] i18n update

Hi there,

after some time I have been able to follow-up on bugzilla 26960 [1] - externalization of UI strings from queries and reports.

The problem was this: MAT uses strings in annotations which in turn show up in the UI. Those strings, however, cannot be internationalized the Eclipse-way (e.g. using a Messages class which binds the properties) because strings in annotations must be static final. Therefore I slightly adapted the method suggested Hiroyuki in [1].


For queries, the mechanism works like this:

In the same package as the query, an "annotations.properties" is expected.
The keys are build like this:

<simple class name>.name --> display name of the query
<simple class name>.category --> category of the query
<simple class name>.help --> help of the query

<simple class name>.<attribute name>.help --> help text of the attribute

<simple class name>.menu.<index of entry>.label --> label of (additional) menu entry
<simple class name>.menu.<index of entry>.category --> category of (additional) menu entry

Consider the following example:

GCRootsQuery.name = GC Roots
GCRootsQuery.category = Java Basics
GCRootsQuery.help = List Garbage Collection (GC) Roots by GC Root type.


The property file overwrites the value of the annotations. Therefore I have made all annotation attributes optional which can contain UI-relevant strings.


For reports, the mechanism is identical to the mechanism used by the plugin.xml:

Prefix the value with a percentage symbol ('%'), if translation is needed:
<section name="%suspects.title">.....



I have changed the existing queries - please let me know if I missed stuff!


Regards,

Andreas.



[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=269608




Andreas Buchen
Senior Software Developer
SAP AG
andreas dot buchen at sap dot com
www.sap.com

Registered Office: Walldorf, Germany | SAP Executive Board: Henning Kagermann (Sprecher/Co-CEO), Léo Apotheker (Sprecher/Co-CEO), Werner Brandt, Erwin Gunst, Claus Heinrich, Bill McDermott, Gerhard Oswald, John Schwarz, Jim Hagemann Snabe | Chairperson of the SAP Supervisory Board: Hasso Plattner | Commercial Register Mannheim No HRB 350269 





Back to the top