简体   繁体   中英

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

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..)

Did you configure the fallback locale?

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

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

sylius.locale: hu_HU

to

sylius.locale: hu

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM