Package io.mybatis.common.util
Class I18n
- java.lang.Object
-
- io.mybatis.common.util.I18n
-
public class I18n extends Object
多语言支持测试时,通过 JVM 参数可以设置 Locale
-Duser.country=US -Duser.language=en- Author:
- liuzh
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceI18n.Language语言包
-
Constructor Summary
Constructors Constructor Description I18n()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static I18n.Languagelanguage(String bundleName)获取语言包static I18n.Languagelanguage(Locale locale, String bundleName)获取语言包static Stringmessage(String bundleName, String key, Object... args)获取对应语言的文本,当资源文件或key不存在时,直接返回MessageFormat.format(key, args)static Stringmessage(Locale locale, String bundleName, String key, Object... args)获取对应语言的文本,当资源文件或key不存在时,直接返回MessageFormat.format(key, args)
-
-
-
Method Detail
-
message
public static String message(Locale locale, String bundleName, String key, Object... args)
获取对应语言的文本,当资源文件或key不存在时,直接返回MessageFormat.format(key, args)- Parameters:
locale- 语言bundleName- 资源文件名key- 字符串keyargs- 格式化参数- Returns:
- 格式化文本
-
message
public static String message(String bundleName, String key, Object... args)
获取对应语言的文本,当资源文件或key不存在时,直接返回MessageFormat.format(key, args)- Parameters:
bundleName- 资源文件名key- 字符串keyargs- 格式化参数- Returns:
- 格式化文本
-
language
public static I18n.Language language(Locale locale, String bundleName)
获取语言包- Parameters:
locale- 语言bundleName- 语言包名称- Returns:
-
language
public static I18n.Language language(String bundleName)
获取语言包- Parameters:
bundleName- 语言包名称- Returns:
-
-