schmittjoh / JMSTranslationBundle

Puts the Symfony2 Translation Component on steroids
http://jmsyst.com/bundles/JMSTranslationBundle
426 stars 292 forks source link

Translation of variable placeholders #401

Closed Aerendir closed 8 years ago

Aerendir commented 8 years ago

I'm using some variable placeholders for my translations.

I've described the problem in full details on StackOverflow.

The bundle is not able to recognize variable placeholders and there is no configuration to fill to make the bundle aware of the variable translations.

The only solution I find is to create a file like _error_messages.html.twig that, read by the bundle make it aware of the placeholders.

But is this a correct approach or maybe there is a better one?

gnat42 commented 8 years ago

When you have a class or form or something that has messages that need to be translated but aren't part of what is automatically detected by the extraction parsing, you can implement an interface TranslationContainerInterface. Under the heading 'Extracting Translation Messages' at http://jmsyst.com/bundles/JMSTranslationBundle/master/usage there are some notes about where messages come from. This should allow you to add your messages to the catalogue.