Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony translations not working

I have done the following checklist:

  1. created translation file respecting format domain.lang.loader
  2. cleared cache
  3. checked that language catalogue is created in cache folder

Though in my twig template file,

{{ 'message'|trans }}

never translates.

Where can I look next in order to make translations work?

Is there any chance that Doctrine Translatable Extension that I am using generates some kind of conflicts?

like image 571
Michael Avatar asked Oct 02 '13 21:10

Michael


2 Answers

In Symfony 3.0 I had to clear the cache:

php bin/console cache:clear

I see you already did that, maybe it helps other like me.

like image 92
zuzuleinen Avatar answered Oct 27 '22 18:10

zuzuleinen


Have you enabled the Translator service in your config file?

framework:
    translator: { fallbacks: en }

The language catalogue is created in your cache folder irrespective of whether your translator is enabled or not.

Did you try translating in your controller?

$trans = $this->get('translator')->trans('message');
like image 20
Ankit Khedekar Avatar answered Oct 27 '22 19:10

Ankit Khedekar