-
Notifications
You must be signed in to change notification settings - Fork 293
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 Translation Bundle does not extract keys from controllers in Symfony2 - getTranslationMessages() #239
Comments
same here.... |
maybe you should set translation domain to your translation which you used in controller. then extract via JMS all translations, generally you should get a new translation file generated named "your_translation_domain.xliff"(if export format .xliff used) |
Im closing this because of inactivity. Feel free to reopen this or create a new issue. |
Just run into this issue..you need the domain in the controller $this->get('translator.default')->trans('trans.key',[],'messages') |
I dont suippose anyone here knows how to extract from a mysql database? eg eyecolor.name : varchar(30) might hold, for instance, "colour.red". I dont want JSM removing all my colour.* codes in the xlf files I hand created when I do an extract - "keep" option isnt good enough as that leaves old unused codes around. How can I tag an xlf file so extract does NOT empty it if there are no codes in the twig/controllers? |
I am using JMS Translation Bundle in my Symfony 2 project.
All translations in the twig files are working great. If I write new keys that need to be translated and run the extract command from command line they get extracted and I can then set appropriate values.
My question is this: I have some messages / keys in the Symfony2 controllers that need to be first extracted and then translated by me. I am writing them like this:
$translator = $this->get('translator');
$message = $translator->trans('FavTrans.No_trans_found');
When I run the extract command now the new translation key doesn't get created and I can't edit it or add translation to it. The command that I run is below.
php app/console translation:extract en ro fr --dir=./src/Smart/Bundle/AdminBundle/Controller/ --output-dir=./app/Resources/translations --output-format=xliff --domain=SmartAdminBundle --keep
Can anyone help? Either telling me that my extract command is wrong, or am I doing the translation in the controller in an unapropriate way?
The text was updated successfully, but these errors were encountered: