Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
I have to develop a site with multilingual content. This also extends to all database information.
now i already had a data entry application in php so now i have to adjust it to facilitate entries both in spanish and english. However i am indecisive about how to design the database to now store english and spanish entries. So i wish to get some advise on the best solution
should i
use separate table...1 for english and 1 is the spanish version
add an additional field for the spanish version of each field of the english version
add the spanish version as a new record entry and add an additional field to indicate if its a spanish entry
Two separate database possibly - why mix apples and oranges unless you really intend using both at the same time?
The advantage is that someone else can dump the English version, cross reference, and update the Spanish version a bit more easily. Also what happens if someone requests you add Portuguese or French or... Simpler not to be crowding so much into one table.
Just make sure you use a suitable character encoding for the database collation and the connection to it.
Maugrim_The_Reaper wrote:Two separate database possibly - why mix apples and oranges unless you really intend using both at the same time?
The advantage is that someone else can dump the English version, cross reference, and update the Spanish version a bit more easily. Also what happens if someone requests you add Portuguese or French or... Simpler not to be crowding so much into one table.
Just make sure you use a suitable character encoding for the database collation and the connection to it.
2 separate databases??! or tables?
P.S. im not sure but does this topic need to moved over to the database forum index? my bad
What I have been doing with some good success is have a languages table that allows people to add languages to the site. Then in the admin section, for the pieces that could be in different languages (description of product, etc), I give the option to set the description in each language that is in the DB. Then when they save it, i put them all together in an array with the language code (en, ee, fi, ru) as the key and they description as the value. Then I serialize it and throw it into the table.
This saves me from having to update the database every time I want to add a language and makes editing the translations much easier. Although, this might not be useful for you, just an idea.
interesting...please tell me more. Cause while i wanted to use the idea of different tables (cause they may add more languages) I am worried about how i may have to code in order to develop some way of easily "switching" between tables based on the language selected for viewing the website.
you say putting the information into an "array"... that might be a bit tedious for a "catalogue" but i may be able to use it as some sort of mechanism for "swtiching"....hhhmmmm
thanks
There are articles on the topic of internationalization in PHP. Give 'em a google