play.i18n
Class Messages

java.lang.Object
  extended by play.i18n.Messages

public class Messages
extends java.lang.Object

I18n Helper

translation are defined as properties in /conf/messages.locale files with locale being the i18n country code fr, en, fr_FR

 # /conf/messages.fr
 hello=Bonjour, %s !
 
Messages.get( "hello", "World"); // => "Bonjour, World !"


Field Summary
protected static java.util.Properties defaults
           
protected static java.util.Map<java.lang.String,java.util.Properties> locales
           
 
Constructor Summary
Messages()
           
 
Method Summary
static java.util.Properties all(java.lang.String locale)
          return all messages for a locale
static java.lang.String get(java.lang.Object key, java.lang.Object... args)
          Given a message code, translate it using current locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaults

protected static java.util.Properties defaults

locales

protected static java.util.Map<java.lang.String,java.util.Properties> locales
Constructor Detail

Messages

public Messages()
Method Detail

get

public static java.lang.String get(java.lang.Object key,
                                   java.lang.Object... args)
Given a message code, translate it using current locale. Notice that if the message can't be found, the string !code! is returned.

Parameters:
key - the message code
args - optional message format arguments
Returns:
translated message

all

public static java.util.Properties all(java.lang.String locale)
return all messages for a locale

Parameters:
locale - the locale code eg. fr, fr_FR
Returns:
messages as a java.util.Properties


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly