ninja.i18n
Interface Lang

All Known Implementing Classes:
LangImpl

public interface Lang


Method Summary
 String get(String key, Locale locale, Object... parameter)
          Get a translated string.
 Map<Object,Object> getAll(Locale locale, Object... parameter)
          The language is determined by the provided locale or a suitable fallback.
 String getWithDefault(String key, String defaultMessage, Locale locale, Object... params)
          Returns a possibly formatted message.
 

Method Detail

get

String get(String key,
           Locale locale,
           Object... parameter)
Get a translated string. The language is determined by the provided locale or a suitable fallback. values of keys can use the MessageFormat. More here: http://docs.oracle.com/javase/6/docs/api/java/text/MessageFormat.html But in short you can use something like mymessage=my message with a placeholder {0} parameter will then be used to fill {0} with the content.


getAll

Map<Object,Object> getAll(Locale locale,
                          Object... parameter)
The language is determined by the provided locale or a suitable fallback. This returns all resources as one map. Usually you want to use that inside your templating engines so that they can access all correctly translated messages.


getWithDefault

String getWithDefault(String key,
                      String defaultMessage,
                      Locale locale,
                      Object... params)
Returns a possibly formatted message.

Parameters:
key - The key
defaultMessage - The default message if the key isn't found
locale - The locale
params - The params
Returns:
The formatted message


Copyright © 2012. All Rights Reserved.