What is the best way of translating long strings with Yii2. If I follow following procedure message generator extract only the first line. If I merge all lines to single it works fine but readability is very poor. Do you guys have any good solution for this.
Ideally, the problem should be solved in Yii’s “message” command, by supporting the concatenated literal strings. But, well, it looks to me a bit difficult to implement. And I agree with you that a very long line could be an obstacle to us, too.
In short, I don’t have any good idea other than dividing the string like the following:
Using and invalid code language assure that the string ERROR_01_PROPERTY_CODE is never shown and instead it goes always on a translation.
If on one side you have a much more readable code, on the other side is going to be a little (but very little) more difficult to do the translation as you do not have the original text inside the language file you are translating, you need to open 2 files at same time.
Thanks for the response. I agree with you. But code segment mentioned is related to email message. Therefore it can contain several lines. I think best option is to go for language specific views for this kind of situation.