Re: Translation2 with MDB2 Container should probably be changed
| From: | Dmitri | Date: | Fri, 25 Apr 2008 16:04:41 +0000 |
| Subject: | Re: Translation2 with MDB2 Container should probably be changed | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-28833@lists.php.net to get a copy of this message | ||
Sorry, actually the table structure of i18n has to be changed a little more
like this:
id int(6) auto_increment
page_id varchar(255)
tr_string char(255)
Then another table will hold actual translation strings and will have
id,
i18n_id,
lang_avail_id
Dmitri wrote:
Hello! I am using Translation2 with MDB2 container to store the translation strings. It works fine, however I think that it's not a good idea to alter the table every time you want to add new language. There has got to be a better way to add new language without the need to alter i18n table There is already another table that stores the list of available languages "lang_avail <tbl_structure.php?db=imagelogtest&table=tr2_lang_avail&token=4dcc0ed38792212d5cc0b5d53005c09f>" What is we just use the id from this table to identify the languageID for example, in i18n table instead of using a separate column for each language string, just use a column lang_avail_id (the value of 'id' from lang_avail table) So, if a site uses 3 languages, then there will be 3 rows for eash string/page value. If a site adds one more language then a new row can easily be added to the i18n for each string/page record (with different lang_avail_id) This should work just fine, My problem with altering table is this: let's say I have an open source project and use Translation2 package with database backend. A client installs my package, then he needs to add a new language support. He add a new language, his table schema changes because the i18n table is altered in his installation He then downloads an upgrade of my package. My package uses MDB2_Schema to automatically update the database schema, so it notices the difference between the latest schema and the client's schema and automatically alters his i18n table, he loses all translation strings for the language that he added before the upgrade.-- Open Source ALL content management with streaming video http://wiki.sharedlog.com