schmittjoh / JMSI18nRoutingBundle

Allows you to internationalize your routing
http://jmsyst.com/bundles/JMSI18nRoutingBundle
358 stars 159 forks source link

jms_i18n_routing extractor always extracts all routes #198

Open jschaedl opened 8 years ago

jschaedl commented 8 years ago

Hi,

I tried to extract routes for one bundle only, but the extractor always extracted all the routes from the application. Here is the command I used:

php app/console translation:extract de --enable-extractor=jms_i18n_routing --bundle=TestShopBundle --output-dir=./app/Resources/translations --keep

and here is the output:

Extracting Translations for locale de Keep old translations: Yes Output-Path: ./app/Resources/translations Directories: /var/www/test.local/src/Test/Bundle/ShopBundle Excluded Directories: ./src Excluded Names: Test.php, TestCase.php Output-Format: # whatever is present, if nothing then xlf #

Custom Extractors: jms_i18n_routing

Loading catalogues from "./app/Resources/translations" Extracting translation keys Extracting messages from directory : /var/www/test.local/src/Test/Bundle/ShopBundle Extracting messages with custom extractor : jms_i18n_routing Added Messages: 742 Deleted Messages: # none as "Keep Old Translations" is true #

Added Messages: 742 but I have much less routes in this bundle...

Am I doing something wrong?

Thanks a lot!

Leprechaunz commented 7 years ago

Hi @jschaedl

translation:extract command creates translations both for routes and translation in twig, that don't have translation in file. So 742 is routes + twig translations

jschaedl commented 7 years ago

Hi @Leprechaunz

sorry, but that's not true. I'm using the custom extractor --enable-extractor=jms_i18n_routing as you can see in the command above which only extracts routes. So no twig translations inside the routes translation file.

Leprechaunz commented 7 years ago

Hi @jschaedl

Even if you use --enable-extractor=jms_i18n_routing anyway it creates translations from twig, but in messages.*.yml file.

You can test it by removing 'messages' translation files and running this command. It will create new 'messages' files from your twig template.

jschaedl commented 7 years ago

@Leprechaunz :-) you are right there is also a messages.*.yml. But it still creates translation for all the application routes inside the routes.*.yml even when I add --bundle=TestShopBundle. So the bundle option had no effect. Any ideas how to resolve this?

Leprechaunz commented 7 years ago

@jschaedl Yes, you are right. It creates route translation for all bundles. Only way you can prevent route from translating is http://jmsyst.com/bundles/JMSI18nRoutingBundle/master/usage#leaving-routes-untranslated But it's not a solution if you want to restrict by bundle.

Sorry, I don't have any better idea for your issue.

bertoost commented 7 years ago

I also have the problem that routes translation per bundle are filled with all routes, instead of the bundle only routes. Would be nice if this works te same as for messages translations. Respect the --bundle=MyBundle option here.