Zend_Translate than maintaining different sets in your database.
If there's a reason to keep it in database or if your categories differ from
language to language, I'd still use the same table, as it makes things a lot
easier in general. You also wouldn't need to different Zend_Db_Tables and thus
no redundant code.
Use Zend_Locale and a model which selects the right categories from your
database using "Categories extends Zend_Db_Table" depending on the
locale/language.
Maurice.
Václav Vaník schrieb:
> Hi guys,
>
> i started to solve multilingual db models and i am finding the best
> practise.
>
> My model looks http://www.walk.cz/download/vicejazycnost.png
> http://www.walk.cz/download/vicejazycnost.png .
>
> It means in my case I will use in ZF views categories_cs and categories_en
> only.
>
> In ZF I have to have 2 models:
>
> class CategoriesCs extends Zend_Db_Table {}
> class CategoriesEn extends Zend_Db_Table {}
>
> But here I have 2 problems:
>
> a) redundant code in both models (could be solved by inheritance, but
> extending is evil, probably could be solved by any design pattern, but I
> dont know which to use)
> b) how to easily create model instance for current language? (the best way
> is imho Factory pattern, but where should be the Factory?)
没有评论:
发表评论