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

Go To StackoverFlow.com

3

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.

2012-04-03 20:08
by ABC
Did you clear the cache - Hubert Perron 2012-04-03 20:24
Actually just done that and it works! Is there any way to disable cache on dev environment - ABC 2012-04-03 20:25
In dev environment Symfony looks for file changes and regenerates the cache if founds some modification, but it does not find new translation files (see issue #3653 - 1ed 2012-04-03 20:47
In my case I couldn't just run cache:clear - I also had to remove everything under the app/cache folder - Prisoner 2013-02-18 11:50


3

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

2012-04-03 20:40
by Elnur Abdurrakhimov
Ads