English and Spanish data entries

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.

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

English and Spanish data entries

Post by kendall »

Hello,

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
Kendall
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

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.
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

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? 8O :?:


P.S. im not sure but does this topic need to moved over to the database forum index? my bad
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Ayah! Tables ;).
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

There are articles on the topic of internationalization in PHP. Give 'em a google
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

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.
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

shiznatix,

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
huh?@ole :?
Post Reply