play.i18n

## Class Messages

- java.lang.Object
- - 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

Fields
`static java.util.Properties` `defaults`
`static java.util.Map<java.lang.String,java.util.Properties>` `locales`

### Constructor Summary

Constructors
Constructor and Description
`Messages()`

### Method Summary

All Methods Static Methods Concrete Methods
`static java.util.Properties` `all(java.lang.String locale)` return all messages for a locale
`static java.util.Properties` `find(java.lang.String locale, java.util.Set<java.lang.String> keys)` Return several messages for a locale
`static java.lang.String` `formatString(java.util.Locale locale, java.lang.String value, java.lang.Object... args)`
`static java.lang.String` `formatString(java.lang.String value, java.lang.Object... args)`
`static java.lang.String` `get(java.lang.Object key, java.lang.Object... args)` Given a message code, translate it using current locale.
`static java.lang.String` `getMessage(java.lang.String locale, java.lang.Object key, java.lang.Object... args)`

### Methods inherited from class java.lang.Object

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

### Field Detail

#### defaults

    public static java.util.Properties defaults

#### locales

    public 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. If there is no message in the current locale for the given key, the key is returned.

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

#### find

    public static java.util.Properties find(java.lang.String locale,
                                            java.util.Set<java.lang.String> keys)

Return several messages for a locale

Parameters:
  `locale` - the locale code, e.g. fr, fr_FR
  `keys` - the keys to get messages from. Wildcards can be used at the end: {'title', 'login.*'}
Returns:
  messages as a `java.util.Properties`

#### getMessage

    public static java.lang.String getMessage(java.lang.String locale,
                                              java.lang.Object key,
                                              java.lang.Object... args)

#### formatString

    public static java.lang.String formatString(java.lang.String value,
                                                java.lang.Object... args)

#### formatString

    public static java.lang.String formatString(java.util.Locale locale,
                                                java.lang.String value,
                                                java.lang.Object... args)

#### 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`