symfonytwigtranslationchinese-localeezpublish

eZPublish & Twig trans filter : chinese translation


I'm currently working on the translation aspect of an eZPublish5 website which will contain 4 languages : french, english, russian and chinese, with french as original language and locale fallback.

Translation of content in backend is working just fine but I'm struggling with translating template parts, which I have encapsulated in {% trans %} filters. I don't think it's directly related to a locale issue because {% trans %} tags are working with french, english and russian, but not in chinese.

To do so I used php ezpublish/console translation:update --output-format=xlf locale bundle --force witch generated messages.fr.xlf, messages.en.xlf, and messages.ru.xlf.

When in chinese, if I dump the locale in twig using {{ app.request.locale }} I get zh_TW for result, so I generated a messages.zh_TW.xlf, without any result.

After a loooong web search regarding language codes of all sort, I started losing patience and generated :

to no avail. This project is my first with eZpublish and I my first multilanguage under the Twig/Symfony logic.

Some code to show language declaration:

//ezpublish/config/ezpublish.yml
ezpublish:
    system:
        chi:
            languages:
            - chi-TW
            - fre-FR
        session:
            name: eZSESSID

Any idea what am I doing wrong ?


Solution

  • Soooo. I found a solution to solve my problem, and I'm quite ashamed to share it here.

    -------Huge Revelation !-------

    $php app/console cache:clear
    

    The first three language files had been created quite a while ago and cache had been cleared a lot since, so that's why these trans files were working. I cleared the cache and now everything is working just fine. BTW the answer to my own question was : messages.zh_TW.xlf

    Now I'm gonna hide myself for a while.