Jump to: navigation, search

E4/EAS/String Localization

< E4‎ | EAS

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");