# Class RWT.NLS

java.lang.Object
org.eclipse.rap.rwt.RWT.NLS

Enclosing class:
  `RWT`

public static final class RWT.NLS extends Object

This utility class helps to provide a similar approach for compile safe native language support than

invalid reference

    NLS

does. We can not use the original approach though, due to the nature of server side environments, that have to deal with different locales per user session or even requests.

Usage:

     public class FooMessages {
       private static final String BUNDLE_NAME = "foo.bar.messages";

       public String MyMessage;

       public static FooMessages get() {
         return ( FootMessages )RWT.NLS.getISO8859_1Encoded( BUNDLE_NAME, FooMessages.class );
       }
     }

BUNDLE_NAME contains the name of a properties file (without file extension) that follows the conventions of standard `ResourceBundle` property files. For each field (in the example 'MyMessage') there has to be a key entry in the localization property file. Use the `FooMessages` like this in the application code:

      Label label = ...;
      label.setText( FooMessages.get().MyMessage );

Since:
  2.0

## Constructor Summary

Constructors
Constructor
Description
`NLS()`

## Method Summary

Modifier and Type
Method
Description
`static <T> T`
`get(String bundleName, Class<T> clazz)`
Returns a NLS object for the given resource bundle and type.
`static <T> T`
`getISO8859_1Encoded(String bundleName, Class<T> clazz)`
Deprecated.
use `get(String bundleName, Class<T> clazz)` instead.
`static <T> T`
`getUTF8Encoded(String bundleName, Class<T> clazz)`
Deprecated.
use `get(String bundleName, Class<T> clazz)` instead.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### NLS

public NLS()

## Method Details

### getISO8859_1Encoded

@Deprecated public static <T> T getISO8859_1Encoded(String bundleName, Class<T> clazz)
Deprecated.
use `get(String bundleName, Class<T> clazz)` instead.
Returns a NLS object for the given resource bundle and type. See class description for usage information. The resource bundles read by this method have to be ISO 8859-1 encoded. This is according to the `Properties` file specification.

Parameters:
  `bundleName` - the resource bundle to load.
  `clazz` - the class of the NLS object to load.

### getUTF8Encoded

@Deprecated public static <T> T getUTF8Encoded(String bundleName, Class<T> clazz)
Deprecated.
use `get(String bundleName, Class<T> clazz)` instead.
Returns a NLS object for the given resource bundle and type. See class description for usage information. The resource bundles read by this method have to be UTF-8 encoded. Note that this is not according to the `Properties` file specification and meant for a more convenient use.

Parameters:
  `bundleName` - the resource bundle to load.
  `clazz` - the class of the NLS object to load.

### get

public static <T> T get(String bundleName, Class<T> clazz)
Returns a NLS object for the given resource bundle and type. See class description for usage information.

Parameters:
  `bundleName` - the resource bundle to load.
  `clazz` - the class of the NLS object to load.
Since:
  3.23