2

I used the following command to generate the catalogs of my different Bundles and it worked well.

php app/console translation:update --dump-messages --force fr ProjectBlogBundle

But how should I do to translate the view that we can find on /app/Resources/views/* ?

Thanks,

Sandoche
  • 561
  • 8
  • 19

3 Answers3

1

If you check the command code, it looks like it's not possible: the bundle name is required and must be provided.

However, you can check this out.

Even though you can't automatically extract/update translation segments from those views, the runtime translation should work, provided that you use the same translation domain.

Community
  • 1
  • 1
alexcasalboni
  • 1,726
  • 1
  • 16
  • 26
1

Even though this question is rather dated, I figured I might add this just for anybody else stumbling across this:

It seems that the desired functionality has been added in the meantime (Symfony 2.8+).

If you run the command like this:

$ app/console translation:update --help
Usage:
  translation:update [options] [--] <locale> [<bundle>]

Arguments:
  locale                               The locale
  bundle                               The bundle name or directory where to load the messages, defaults to app/Resources folder

It seems the bundle name has become optionale and the command will default to app/Resources

Jan
  • 907
  • 1
  • 8
  • 23
0

I had the same problem, and the @Jan's answer helped me. So there is an example.

cd app/
php ./console console translation:update --dump-messages --force fr .

As . is a directory (the current directory), the translator will try to load the subdirectory /Resources, so here it will try to load app/Resources/.

Anthony
  • 2,014
  • 2
  • 19
  • 29