开发者

Is it good idea to use i18n inside model files, symfony 1,4?

开发者 https://www.devze.com 2023-03-12 04:33 出处:网络
Hey there I was just wondering is it good to use i18n inside the model files. Though I am suspecting only controller knows what language at the moment is active.

Hey there I was just wondering is it good to use i18n inside the model files. Though I am suspecting only controller knows what language at the moment is active. I just wanted to ask befor开发者_开发技巧e moving on. Sorry if it is not so complex question!


I think i18n should be use only in the View layer (not in the model). Calling up helpers for translation inside model to translate some text or date, seems to me more like a rendering problem rathen than a data manipulation one. So try to modifie your solution to fit the way symfony does this kind of stuff.

My advise is to try to keep the MVC stack as clean and abstract in each layer as possible. Once you go inside the rabbit hole, you wont be able to come back easy :P

0

精彩评论

暂无评论...
验证码 换一张
取 消