ninja.i18n
Class LangImpl

java.lang.Object
  extended by ninja.i18n.LangImpl
All Implemented Interfaces:
Lang

public class LangImpl
extends Object
implements Lang


Constructor Summary
LangImpl(NinjaProperties ninjaProperties)
           
 
Method Summary
 String get(String key, Locale locale, Object... params)
          Returns a possibly formatted message.
 Map<Object,Object> getAll(Locale locale, Object... params)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LangImpl

@Inject
public LangImpl(NinjaProperties ninjaProperties)
Method Detail

get

public String get(String key,
                  Locale locale,
                  Object... params)
Returns a possibly formatted message.

Specified by:
get in interface Lang
Parameters:
key -
params -
Returns:
a pssibly formatted message or null if not found.

getAll

public Map<Object,Object> getAll(Locale locale,
                                 Object... params)
Description copied from interface: Lang
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.

Specified by:
getAll in interface Lang

getWithDefault

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

Specified by:
getWithDefault in interface Lang
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.