Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "E4/EAS/String Localization"

< E4‎ | EAS
(New page: String localization is an important part of any product that markets itself for an international audience and the Eclipse platform is no different. As the Eclipse platform extends itself t...)
 
(Eclipse 3.x API)
Line 2: Line 2:
  
 
==Eclipse 3.x API==
 
==Eclipse 3.x API==
In Eclipse 3.x, clients use the NLS API to populate strings with their localized content and for providing arguments to their messages.
+
In Eclipse 3.x, clients use the org.eclipse.osgi.util.NLS API to populate strings with their localized content and for providing arguments to their messages.
  
 
Populating the strings:
 
Populating the strings:
 
<source lang="java">
 
<source lang="java">
 
package org.eclipse.e4.internal.core.localization;
 
package org.eclipse.e4.internal.core.localization;
 +
 +
import org.eclipse.osgi.util.NLS;
  
 
public class Messages extends NLS {
 
public class Messages extends NLS {

Revision as of 21:51, 23 October 2009

String localization is an important part of any product that markets itself for an international audience and the Eclipse platform is no different. As the Eclipse platform extends itself to other avenues beyond the desktop, it must continue to ensure that NLS is present. It must be possible for contributions, dynamically contributed through a plugin.xml or in code, to be localized. See bug 226340 and bug 244468 for more information.

Eclipse 3.x API

In Eclipse 3.x, clients use the org.eclipse.osgi.util.NLS API to populate strings with their localized content and for providing arguments to their messages.

Populating the strings:

package org.eclipse.e4.internal.core.localization;
 
import org.eclipse.osgi.util.NLS;
 
public class Messages extends NLS {
 
  private static final String BUNDLE_NAME = "org.eclipse.e4.internal.core.localization.messages"; //$NON-NLS-1$
 
  public static String Some_Message_With_Arguments;
 
  static {
    NLS.initializeMessages(BUNDLE_NAME, Messages.class);
  }
}

Using the strings:

text.setText(NLS.bind(Messages.Some_Message_With_Arguments, "org.eclipse.e4.core", "E4");

Back to the top