public class I18n extends Object
测试时,通过 JVM 参数可以设置 Locale -Duser.country=US -Duser.language=en
| Modifier and Type | Class and Description |
|---|---|
static interface |
I18n.Language
语言包
|
| Constructor and Description |
|---|
I18n() |
| Modifier and Type | Method and Description |
|---|---|
static I18n.Language |
language(Locale locale,
String bundleName)
获取语言包
|
static I18n.Language |
language(String bundleName)
获取语言包
|
static String |
message(Locale locale,
String bundleName,
String key,
Object... args)
获取对应语言的文本,当资源文件或key不存在时,直接返回
MessageFormat.format(key, args) |
static String |
message(String bundleName,
String key,
Object... args)
获取对应语言的文本,当资源文件或key不存在时,直接返回
MessageFormat.format(key, args) |
public static String message(Locale locale, String bundleName, String key, Object... args)
MessageFormat.format(key, args)locale - 语言bundleName - 资源文件名key - 字符串keyargs - 格式化参数public static String message(String bundleName, String key, Object... args)
MessageFormat.format(key, args)bundleName - 资源文件名key - 字符串keyargs - 格式化参数public static I18n.Language language(Locale locale, String bundleName)
locale - 语言bundleName - 语言包名称public static I18n.Language language(String bundleName)
bundleName - 语言包名称Copyright © 2023. All rights reserved.