ggirtsou
ggirtsou

Reputation: 2048

How to load yml files instead xliff for translating a Symfony application

I'm trying to make a multi-language application with Symfony2 and I'm currently trying to use yml files for translation instead of xliff (I guess this is the default one).

Based on Symfony's documentation php, yml and xliff files are accepted.

What I am unable to find is where I must set that the translation file is a yml one.

When I delete the messages.fr.xliff and make a messages.fr.yml I get an exception:

[WARNING 1549] failed to load external entity "/home/ggirtsou/www/app.dev/src/ggirtsou/MyBundle/Resources/translations/messages.fr.xliff" (in n/a - line 0, column 0) 

I used $this->get('session')->setLocale('fr'); to set the locale to French.

Upvotes: 3

Views: 4284

Answers (1)

Elnur Abdurrakhimov
Elnur Abdurrakhimov

Reputation: 44831

You need to clear the cache whenever you add or move translation files. No need to do that when just editing them.

Upvotes: 3

Related Questions