How to use Yii with a multilingual database model?

后端 未结 3 1209
执念已碎
执念已碎 2021-02-08 06:38

I’m having a problem getting the data from my database which I created to be completely multilingual, and I hope someone here can help me.

I’ve split up all my tables in

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-08 07:13

    Have you tried http://www.yiiframework.com/extension/i18n-columns/ (based on http://www.yiiframework.com/extension/stranslateablebehavior/)?

    It is an alternate, simpler, approach by adding new table fields in the style of {field}_{language code}, and then setting the translated field in the original model to the current language's translation on afterFind.

    In essence, it will get you up and running with translatable fields with the translated content being fetched "automatically", for good and bad :). Adding and removing languages (=columns) is done using migrations.

提交回复
热议问题