1

I am building single language Symfony (v4.4.7) application. As I understood from the documentation I need to set

framework:
    default_locale: tr
    translator:
        default_path: '%kernel.project_dir%/translations'
        fallbacks:
            - en

in config/packages/translation.yaml to change lang in the whole application.

Using configuration above custom translations are working! However, Symfony Security library still showing messages in English (e.g Invalid credentials. when user password is incorrect). Removing default_path: '%kernel.project_dir%/translations' line does not help. I tried to change the default_locale to other languages still the same result.

Edit 1 more details: Content of translations directory: enter image description here

messages.tr.yaml contains following lines:

security:
   roles_label: "Roller"
   roles:
       ROLE_SUPER_ADMIN: "Super Admin"
       ROLE_ADMIN: "Admin"
       ROLE_USER: "Genel Kullanıcı"

I deleted content of the messages.tr.yaml and tried again but it is still not working. Other tr translation files does not contain security keyword

Nuryagdy Mustapayev
  • 667
  • 1
  • 7
  • 27
  • hey! did you find a solution? I have the exact same problem here – onionpsy Oct 12 '20 at 15:02
  • Did you generate translations files for Turkish like `security.tr.yaml`? – Liscare Oct 12 '20 at 15:28
  • @onionpsy no I don't work on that project anymore. – Nuryagdy Mustapayev Oct 12 '20 at 15:47
  • @Liscare No I did not generate Security translation file since Symfony has it in its package – Nuryagdy Mustapayev Oct 12 '20 at 15:48
  • @NuryagdyMustapayev Can we see the content of the folder called: `translations`? – Liscare Oct 13 '20 at 06:23
  • @Liscare added details you asked – Nuryagdy Mustapayev Oct 13 '20 at 13:37
  • It seems that you have problems with domain, see [doc](https://symfony.com/doc/current/translation.html#the-translation-process). Specify your domain (`security` in this case), because the default one is `message`. If you use Twig, see [doc](https://symfony.com/doc/current/translation/templates.html#using-twig-tags). Also you can generate security.tr.yaml file with this command `php bin/console translation:update --force tr --output-format yaml` – Liscare Oct 13 '20 at 14:50

0 Answers0