-
StackOverflow 文档
-
internationalization 教程
-
国际化
-
ICU4J 通过 MessageFormat 类实现 Scala 的多元化
import com.ibm.icu.text.MessageFormat
import java.util.Locale
import scala.collection.JavaConverters._
// Outputs "A common message for all options. Selected: (other)"
val formatted = new MessageFormat(
"{messageCount, plural, one {{aMessage} (one)} other {{aMessage} (other)} }",
new java.util.Locale("en_US")
).format(Map(
"messageCount" -> 900,
"aMessage" -> "A common message for all options. Selected: "
).asJava)