2014-10-22 66 views
2

当我运行命令JmsI18NBundle - 在翻译都必须设置

php app/console translation:extract en --enable-extractor=jms_i18n_routing 

我得到以下错误的目录:

[JMS\TranslationBundle\Exception\InvalidArgumentException] 
The directory where translations are must be set. 

这是束配置:

jms_i18n_routing: 
default_locale: it 
locales: [it, en] 
strategy: prefix 
cookie: 
    enabled: false 

那有什么问题?

回答

4

您可以通过使用--dir选项来定义运行translation:extract命令时翻译所在的目录。

From the documentation,

For dumping, the bundle provides you with a console command which you can use to update your translation files, or also just to preview all changes that have been made.

更新文件:

php app/console translation:extract de --dir=./src/ --output-dir=./app/Resources/translations 
+0

我试图定义--dir选项,但它不起作用。 我修复了指定包和域选项的错误 – jury89 2014-10-22 09:23:02

+0

好的,我不确定,但我认为你也可以在你的配置中设置域。 – 2014-10-22 09:30:52

+0

我认为我的解决方案和您的解决方案都有效,不同之处在于,您想通过解决方案将所有路线转换并将routes.en.yml放在应用程序文件夹中,而使用我的解决方案,您可以转换特定的包和地点里面的routes.en.yml – jury89 2014-10-22 10:40:44

0

我不得不使用下面的命令

php app/console translation:extract en --enable-extractor=jms_i18n_routing --bundle="AcmeFooBundle" --domain="routes"