Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jms_i18n_routing extractor always extracts all routes #198

Open
jschaedl opened this issue Oct 27, 2016 · 6 comments
Open

jms_i18n_routing extractor always extracts all routes #198

jschaedl opened this issue Oct 27, 2016 · 6 comments

Comments

@jschaedl
Copy link

jschaedl commented Oct 27, 2016

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
Copy link

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
Copy link
Author

jschaedl commented Nov 5, 2016

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
Copy link

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
Copy link
Author

jschaedl commented Nov 5, 2016

@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
Copy link

@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
Copy link

bertoost commented Aug 3, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants