Multi language in the database with CodeIgniter
I'm developing a CodeIgniter based site that will be very multi language heavy. Plan is to launch with 5 langs but to rapidly expand. A lot of the content will be user generated and split across multiple tables. In the past I have used the built in language files but I don't think they are going to work in this case. What's the best way to do translations in the database. Should I have a translation table for each table in my DB, eg; ProductsLang RetailersLang CategoriesLang Etc
Or should I look at creating some sort of central dictionary table. Has anyone done this in CI in the past, couldn'开发者_如何学Got find any existing libaries out there. Your thoughts would be much appreciated.
From my view it really depends on the solution you need - it seems like you're developing an online shop? If that's the case, I would combine both options. Static language files for labels (and other content that shouldn't change).
Although - IMO - the product database shouldn't be aware of an actual translation part; I would rather take the category table and put in the necessary languages as main categories and provide with product-specific categories below the language categories.
At this point you'd might be thinking of all the duplicate products attached to any given language category - but I believe this is a flexible solution for each of the languages.
And a simple script could allow for copying a language category to another, making translation available for the exact same products.
精彩评论