congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
play.i18n
Code IndexAdd Tabnine to your IDE (free)

How to use play.i18n

Best Java code snippets using play.i18n (Showing top 20 results out of 315)

origin: com.typesafe.play/play-test_2.11

/**
 * Constructs a MessagesApi instance containing the given keys and values.
 *
 * @return a messagesApi instance containing given keys and values.
 */
public static MessagesApi stubMessagesApi(Map<String, Map<String, String>> messages, play.i18n.Langs langs) {
  return new play.i18n.MessagesApi(
    new play.api.i18n.DefaultMessagesApi(messages, langs)
  );
}
origin: com.typesafe.play/play_2.10

/**
* Translates a message.
*
* Uses `java.text.MessageFormat` internally to format the message.
*
* @param key the message key
* @param args the message arguments
* @return the formatted message or a default rendering if the key wasn't defined
*/
public static String get(String key, Object... args) {
  return getMessagesApi().get(getLang(), key, args);
}
origin: com.typesafe.play/play_2.10

/**
* Check if a message key is defined.
* @param lang the message lang
* @param key the message key
* @return a Boolean
*/
public static Boolean isDefined(Lang lang, String key) {
  return getMessagesApi().isDefinedAt(lang, key);
}
origin: com.typesafe.play/play_2.10

/**
 * Get the message at the given key.
 *
 * Uses `java.text.MessageFormat` internally to format the message.
 *
 * @param key the message key
 * @param args the message arguments
 * @return the formatted message or a default rendering if the key wasn't defined
 */
public String at(String key, Object... args) {
  return messages.get(lang, key, args);
}
origin: com.typesafe.play/play_2.11

/**
 * Get the message at the given key.
 *
 * Uses `java.text.MessageFormat` internally to format the message.
 *
 * @param key the message key
 * @param args the message arguments
 * @return the formatted message or a default rendering if the key wasn't defined
 */
default String apply(String key, Object... args) {
  return at(key, args);
}
origin: com.typesafe.play/play_2.10

/**
* Translates a message.
*
* Uses `java.text.MessageFormat` internally to format the message.
*
* @param lang the message lang
* @param key the message key
* @param args the message arguments
* @return the formatted message or a default rendering if the key wasn't defined
*/
public static String get(Lang lang, String key, Object... args) {
  return getMessagesApi().get(lang, key, args);
}
origin: com.typesafe.play/play_2.10

/**
* Check if a message key is defined.
* @param key the message key
* @return a Boolean
*/
public static Boolean isDefined(String key) {
  return getMessagesApi().isDefinedAt(getLang(), key);
}
origin: com.typesafe.play/play

/**
 * Check if a message key is defined.
 *
 * @param key the message key
 * @return a Boolean
 */
public Boolean isDefinedAt(String key) {
  return messagesApi.isDefinedAt(lang, key);
}
origin: com.typesafe.play/play_2.11

/**
 * Convert to a Java Locale value.
 */
public java.util.Locale toLocale() {
  return locale();
}
origin: com.typesafe.play/play_2.11

/**
 * Get the message at the given key.
 *
 * Uses `java.text.MessageFormat` internally to format the message.
 *
 * @param key the message key
 * @param args the message arguments
 * @return the formatted message or a default rendering if the key wasn't defined
 */
public String at(String key, Object... args) {
  return messagesApi.get(lang, key, args);
}
origin: com.typesafe.play/play_2.10

/**
* Translates the first defined message.
*
* Uses `java.text.MessageFormat` internally to format the message.
*
* @param keys the messages keys
* @param args the message arguments
* @return the formatted message or a default rendering if the key wasn't defined
*/
public static String get(List<String> keys, Object... args) {
  return getMessagesApi().get(getLang(), keys, args);
}
origin: com.typesafe.play/play_2.11

/**
 * Get the message at the first defined key.
 *
 * Uses `java.text.MessageFormat` internally to format the message.
 *
 * @param keys the messages keys
 * @param args the message arguments
 * @return the formatted message or a default rendering if the key wasn't defined
 */
default String apply(List<String> keys, Object... args) {
  return at(keys, args);
}
origin: com.typesafe.play/play_2.10

/**
* Translates the first defined message.
*
* Uses `java.text.MessageFormat` internally to format the message.
*
* @param lang the message lang
* @param keys the messages keys
* @param args the message arguments
* @return the formatted message or a default rendering if the key wasn't defined
*/
public static String get(Lang lang, List<String> keys, Object... args) {
  return getMessagesApi().get(lang, keys, args);
}
origin: com.typesafe.play/play_2.11

/**
 * Check if a message key is defined.
 *
 * @param key the message key
 * @return a Boolean
 */
public Boolean isDefinedAt(String key) {
  return messagesApi.isDefinedAt(lang, key);
}
origin: com.typesafe.play/play-test_2.12

/**
 * Constructs a MessagesApi instance containing the given keys and values.
 *
 * @return a messagesApi instance containing given keys and values.
 */
public static MessagesApi stubMessagesApi(Map<String, Map<String, String>> messages, play.i18n.Langs langs) {
  return new play.i18n.MessagesApi(
    new play.api.i18n.DefaultMessagesApi(messages, langs)
  );
}
origin: com.typesafe.play/play_2.11

/**
 * Get the message at the first defined key.
 *
 * Uses `java.text.MessageFormat` internally to format the message.
 *
 * @param keys the messages keys
 * @param args the message arguments
 * @return the formatted message or a default rendering if the key wasn't defined
 */
public String at(List<String> keys, Object... args) {
  return messagesApi.get(lang, keys, args);
}
origin: com.typesafe.play/play

/**
 * Get the message at the given key.
 *
 * Uses `java.text.MessageFormat` internally to format the message.
 *
 * @param key the message key
 * @param args the message arguments
 * @return the formatted message or a default rendering if the key wasn't defined
 */
default String apply(String key, Object... args) {
  return at(key, args);
}
origin: com.typesafe.play/play-test_2.11

/**
 * Constructs an empty messagesApi instance.
 *
 * @return a messagesApi instance containing no values.
 */
public static MessagesApi stubMessagesApi() {
  return new play.i18n.MessagesApi(new play.api.i18n.DefaultMessagesApi
      (Collections.emptyMap(), new DefaultLangs().asJava()));
}
origin: com.typesafe.play/play_2.12

/**
 * Get the message at the first defined key.
 *
 * Uses `java.text.MessageFormat` internally to format the message.
 *
 * @param keys the messages keys
 * @param args the message arguments
 * @return the formatted message or a default rendering if the key wasn't defined
 */
public String at(List<String> keys, Object... args) {
  return messagesApi.get(lang, keys, args);
}
origin: com.typesafe.play/play-test_2.12

/**
 * Constructs an empty messagesApi instance.
 *
 * @return a messagesApi instance containing no values.
 */
public static MessagesApi stubMessagesApi() {
  return new play.i18n.MessagesApi(new play.api.i18n.DefaultMessagesApi
      (Collections.emptyMap(), new DefaultLangs().asJava()));
}
play.i18n

Most used classes

  • Messages
    I18n Helper translation are defined as properties in /conf/messages.locale files with locale being t
  • Lang
    A Lang supported by the application.
  • MessagesApi
    The messages API.
  • MessagesImpl
    This class implements the Messages interface. This class serves two purposes. One is for backwards c
  • Langs
    Manages languages in Play
  • MessagesPlugin
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now