Sunday 15 January 2012

php - Symfony 2 message translation -


Before I asked this question, I have carefully checked many similar people, but have not solved it anyway . / P>

This work is to use Russian messages instead of English. This known authentication fails to accept the message in the case of "bad credentials."

  Translator: {fallback: en} default_locale: ru   

Created Messages.ru.xliff

  & lt ;? XML version = "1.0"? & Gt; & Lt; Xliff version = "1.2" xmlns = "vase: oasis: name: tc: excl. Document: 1.2" & gt; & Lt; File source-language = "en" datatype = "plain text" basically "file.ext" & gt; & Lt; Body & gt; & Lt; Trans-unit id = "1" & gt; & Lt; Source & gt; Bad credentials & lt; / Source & gt; & Lt; Target & gt; My Russian version is here & lt; / Target & gt; & Lt; / Trans unit & gt; & Lt; / Body & gt; & Lt; / File & gt; & Lt; / Xliff & gt;   

And finally, in my login.html.twig:

  {% error%} and 

Even when the authentication fails, I still continue to receive a "bad credential" message. I tried to clear the cache, but it does not help.

Maybe I remembered any help appreciated Thanks.

I think the problem is because you specified the source translation as "bad credentials" But "error.message" as the input for "translator" then your messages.ru.xliff should look more:

   gt; & lt; body & gt; & lt; trans-unit id = "1" & gt; & lt; source & gt; error.message & lt; / source & gt; & lt; target & gt; My Russian version here & lt; / target & gt; & lt; / trans unit & Gt; & lt; / body & gt; & lt; / file> & lt; / xliff & gt;   

Or change the message label in your template: {}" {{"Bad credentials" | TRANS}} {% endif%}

No comments:

Post a Comment