Attila Fulop
Attila Fulop

Reputation: 7011

Symfony Translation Doesn't Work In Production

I have a symfony (2.8) app (Sylius actually) and I'm overriding some parts of the translation from SyliusUserBundle in app/Resources/translations/messages.en.yml (namely, the translation key is sylius.customer.email.unique)

It works like charm on local dev env, but gives me the key on production. I did clear the cache, multiple times, and it doesn't help.

What are other possible causes?

UPDATE Gives the translation found in the SyliusUserBundle for English (as it exists in the original bundle) but gives the key in other languages, where the original bundle doesn't contain the translation. So as a summary, it seems that translation files app/Resources/translations/messages.<lang>.yml are not being picked up on prod for some reason.

UPDATE 2 I also have discovered that the key with the valid translation is present in this file: app/cache/prod/translations/catalogue.hu_HU.ba674f8d2fd06750dcd7ee5bb021c1b905b518ea.php

Upvotes: 3

Views: 1034

Answers (3)

Attila Fulop
Attila Fulop

Reputation: 7011

Moving the keys into separate files:

app/Resources/translations/validators.en.yml
app/Resources/translations/validators.hu.yml

has solved the problem.

(An interesting question is why did it work on my dev env..)

Upvotes: 1

Lowlo
Lowlo

Reputation: 18

Try rename your file with messages.hu.yml and if not work change:

sylius.locale: hu_HU

to

sylius.locale: hu

Upvotes: 0

gvf
gvf

Reputation: 1039

Did you configure the fallback locale?

# app/config/config.yml
framework:
    translator: { fallbacks: [en] }

Upvotes: 0

Related Questions