Since a few weeks I started playing with Symfony2. It seems a very powerful framework, but there are some things I cannot still understand.
In documentation I see that i18n (i.e. Translations) is managed by the Translator service. If I correctly understood, the main way to have a website translated is to put the collection of messages I want to translate inside the different files messages.XX.yml
(XX=en,fr,it,etc...
), one for each language.
This could be perfect for short texts, which possibly do not include any HTML markup. But how do you deal with long text? For instance, how can I manage the translation of a Terms Of Service or an About page?
I guess I should include different templates for each locale I want to use. Am I right?
Thanks for your help!
Google Translate It's very simple to use, and allows for instant translation of text, websites, images, and videos from one language to another. You can translate single words or entire phrases and paragraphs. Google Translate is available for over 100 languages, and is completely free to use!
Another reason why this happens (especially in technical and specialized areas) is because the translator is unaware of the subject and tries to paraphrase, instead of using a single term as in the original text. When we confuse translating with explaining, the length of the translated text increases.
In translation, a source text is the original text that is to be translated into another language.
Translation is the transmittal of written text from one language into another. Although the terms translation and interpretation are often used interchangeably, by strict definition, translation Refers to the written language, and interpretation to the spoken word.
You can have long texts in .yml translation file as well as html tags. Put your Terms Of Service text in messages.xx.yml file like this:
TermsOfServiceText: > <p>Here goes my Terms of service code</p> <p>It can be put in several lines and <strong>can include html tags!</strong></p> <p>It can also include <a href="http://symfony.com/doc/current/book/translation.html" rel="nofollow">links</a></p> <p>Just make sure that you put '>' sign after your translation keyword like in the first line of this example code and start your message in next line with double space indentation</p>
Now, in your twig
template call translation with this:
{{ 'TermsOfServiceText'|trans|raw }}
raw
is used to skip escaping html tags.
I don't think that different templates could be as solution. But feel free to choose what you prefer. I'll go with https://github.com/stof/StofDoctrineExtensionsBundle in particular with the Translatable behaviour.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With