Вопрос

I'm currently using a per-module translation approach. I.e, I have translation files for each module separately. But it's come to my attention that if we use translate('x') in module 'foo' and 'x' is translated to 'y' in module 'bar', translate('x') returns 'y' in module foo. So my question is, is there a problem if I create one single catalog for all modules? Cause right now updating the language files is kinda annoying.

Thanks

Это было полезно?

Решение

The point of using per module translations is to have separate translation domains, so that modules are independent and key collisions are eliminated.

What you are basically doing is translate('x', 'default'), that always returns 'y' if you define the translation of 'x' to 'y' in the domain 'default'.

If you write your modules as independent, you should use different translation domains. If you don't plan on using the modules separately, you can use just one translation domain and one translation file, e. g. in the Application module or by using the database for translation storage/update.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top