开发者

Symfony translate database value before output

开发者 https://www.devze.com 2023-03-31 15:34 出处:网络
I have a table for \'alerts开发者_如何学Go\'. I would like to store there the alerts for the users in Engligh, and translate the alert into the users\' culture before showing it. Like an usual message

I have a table for 'alerts开发者_如何学Go'. I would like to store there the alerts for the users in Engligh, and translate the alert into the users' culture before showing it. Like an usual message which is translated with the __() function.

Is this thing possible in Symfony 1.4?


How many alerts do you have? Doubt that more than 100, no? It is normal to store stuff this size in xml translation files, anyway they are cached. And it is more simple to add new items in xml files than in database.


Should be no problem if you have messages.en.xml and messages.xx.xml which reflect the entries in the db. I haven't done it but I don't see why it should work ...

0

精彩评论

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

关注公众号