FriendsOfSymfony / FOSJsRoutingBundle

A pretty nice way to expose your Symfony routing to client applications.
1.48k stars 261 forks source link

Dumping multiple locales does not behave as expected #425

Closed sprain closed 2 years ago

sprain commented 2 years ago

The docs for fos:js-routing:dump state:

If you are using JMSI18nRoutingBundle, you need to run the command with the --locale parameter once for each locale you use and adjust your include paths accordingly. (Source)

So if I understand correctly you need to run the command multiple times:

$ bin/console fos:js-routing:dump --locale=en
$ bin/console fos:js-routing:dump --locale=fr

What happens is that the second command overwrites the dump of fos_js_routes.js created by the first command. In my understanding it should instead create multiple files, like fos_js_routes.en.js and fos_js_routes.fr.js.

Is my understanding of how it is supposed to work wrong? If not, would you accept a pr which introduces the expected behaviour are mentioned above in a bc-friendly way? If so, would it be accepted in the v2 branch, too?

Or are you supposed to use --target? In this case it would need a clearer documentation (which I could also make a pr for).

tobias-93 commented 2 years ago

Hi @sprain, there is no convention for this at the moment. I don't use the bundle with the locale functionality, but to my understanding using --target would make the most sense (then everyone can use the filename they find most convenient). If you want to make a PR to clarify this in the documentation then go ahead 😄