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
[translation][extractor] double translation of forms labels / implementing labels extractor feature #33499
Comments
I am closing here since this is indeed not a bug but the expected behaviour and setting the translation domain to |
well, we should not be translating the label in the form type when passing the |
I don't see that pattern used anywhere in the docs. |
@sabat24 can you share with us where you saw that advice in the official documentation ? |
In translation component in summary there is information:
In different parts of doc, there is also mentioned indirectly that extractor searches for
For me based mainly on first statement it was an obvious conslusion that if I want get translations extracted from my form class I need use Translator service and |
@stof is the only way to extract the label strings for translation the approach used by sabat24? (using translator service in the Form Class). |
Translaction extractor can't extract texts from labels in form builder. Offical doc is advising to DI translator and use it when creating labels. So for example I have got something like that:
Extractor extracts that placeholder correctly, but then I get errors in SF profiler that I have got a lot of missing translations.
I think it is because of that Form component is trying to translate again the text, which was already translated and passed to label.
In this case is there an option to tell Form that it shouldn't translate my labels?
answer translation_domain = false
What is more confusing - why extractor just can't extract labels directly from forms?
There is a JMSTranslationBundle which handles quite well with extracting labels from form builders and it can do it since SF 2.0. Is there any reason why you didn't add such option to your extractor? (are going to do that in very near future?)
It leads to another problem. Let's assume that I have got in my messages domain a translation for "Email" placeholder. It will result with wrong translation of label.At first translator translates 'email' from 'admin' domain to 'Email'. Then Form component translates 'Email' from messages domain to something like 'Email is a fun thing'.Is there any solution to the first problem of double translation of labels?EDIT
Ok I found that I need to use 'translation_domain' set as false when adding fields. It wasn't very obvious at first to me.
The text was updated successfully, but these errors were encountered: