Package com.axelor.i18n
Class I18n
- java.lang.Object
-
- com.axelor.i18n.I18n
-
public final class I18n extends Object
This class provider methods for internationalization (I18n) services.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
get(String message)
Return the localized translation of the given message, based on the current language.static String
get(String singular, String plural, int number)
Similar to theget(String)
but considers plural form based on the given number value.static ResourceBundle
getBundle()
Get the resource bundle for the currentLocale
.static ResourceBundle
getBundle(Locale locale)
Get a resource bundle for the given locale.
-
-
-
Method Detail
-
getBundle
public static ResourceBundle getBundle(Locale locale)
Get a resource bundle for the given locale.- Parameters:
locale
- the locale for which a resource bundle is desired- Returns:
- an instance of
I18nBundle
-
getBundle
public static ResourceBundle getBundle()
Get the resource bundle for the currentLocale
.- Returns:
- an instance of
I18nBundle
-
get
public static String get(String message)
Return the localized translation of the given message, based on the current language.- Parameters:
message
- the original message to be translated- Returns:
- the localized message or the message itself if not found.
-
get
public static String get(String singular, String plural, int number)
Similar to theget(String)
but considers plural form based on the given number value.assertEquals("1 record selected.", I18n.get("{0} record selected.", "{0} records selected.", 1)); assertEquals("5 records selected.", I18n.get("{0} record selected.", "{0} records selected.", 5));
- Parameters:
singular
- the singular form of the original messageplural
- the plural form of the original messagenumber
- the value to decide plurality- Returns:
- the localized singular or plural message or the original message itself if not found.
-
-