我用Spring Roo 2.0.0.M3创建了一个网站,当我尝试添加一种语言时,它说:
roo> addon create i18n --topLevelPackage com.foo --locale fr
Command 'addon create i18n --topLevelPackage com.foo --locale fr' was found but is not currently available (type 'help' then ENTER to learn about this command)
所以我读过 Roo 提供了 6 种语言,但据说 hust 英语和西班牙语是可能的值。也许版本 2.0.0.M3 不包含其他语言。
roo> help web mvc language
SYNOPSIS
web mvc language [OPTIONS]
DESCRIPTION
Installs new language in generated project views. Also, could be used to
specify the default language of the project.
OPTIONS
--code The language code for the desired bundle.Possible values are:
supported languages. Currently `en` (English, default) and `es` (Spanish).
所以问题是我如何使用 Roo 2.0.0.M3 添加一种语言,例如 fr?
您尝试使用的命令addon create i18n --topLevelPackage com.foo --locale fr
可用于创建新i18n bundle
。
生成的捆绑包包含一个messages.properties
文件,您应该将其翻译成所需的语言。之后,您应该使用 addon install
命令将此bundle
包含在 Spring Roo 外壳中。这样,当您尝试使用 web mvc language
命令时,--code
参数将使用 es
、en
代码和您创建的语言自动完成。
抱歉,如果Spring Roo参考指南说它提供了6种语言。我会检查的。
希望对您有所帮助,
注意:请记住,仅当您之前未在当前文件夹中创建 Spring 项目时,addon create i18n --topLevelPackage com.foo --locale fr
命令才可用。