I am really interested in the same answer...
I am making a script.. and as I will only have 2 languages I decided to use
you 3rd option (Fields for each language), because of less rows.
But I really would like to know if there is a better approach to this.
*eg. php function:*
function getRecipeName($id) {
global $database;
$query = mysql_query("SELECT name_english,name_spanish
FROM ".$database['prefix']."recipes
WHERE id = '$id'
LIMIT 1
") or die(mysql_error());
$RECIPES = mysql_fetch_object($query);
if (ACTIVE_LANG == "spanish" && $RECIPES->name_spanish != "") {
$return = "".$RECIPES->name_spanish.""; }
elseif (ACTIVE_LANG == "spanish" && $RECIPES->name_spanish == "") {
$return = "".$RECIPES->name_english." [Sólo inglés disponible]"; }
elseif (ACTIVE_LANG == "english" && $RECIPES->name_english != "") {
$return = "".$RECIPES->name_english.""; }
else {$return = "".$RECIPES->name_spanish." [Only spanish available]"; }
return $return;
}
Engel
2009/11/27 Elizabeth Mattijsen <[email protected]>
> On Nov 27, 2009, at 4:34 PM, Miguel Vaz wrote:
> > This is my first post, and could use some points of view on the subject.
> > Have a project that will have several languages for its records, for
> places,
> > for example, whose names and descriptions will be in 3 languages.
> >
> > Have already read several sites about it but always end up with several
> > perspectives:
> >
> > 1 - Tables for each language: places_pt, places_en, places_es, with
> fields:
> > id, name, description; Seems superfluous, but will leave less records on
> > each table, although adding a great amount of tables, the more languages
> i
> > have;
> >
> > 2 - Rows for each language: id, lang, name, description - the field
> "lang"
> > will have "pt", "en" or "es", and when displaying, i will have to lookup
> the
> > active language and get the proper record; Will add tremendously to the
> > record #;
> >
> > 3 - Fields for each language: table "places", with fields: id, name_pt,
> > name_en, name_es, description_pt,description_en,description_es - not
> likely
> > to add a new language, but still adding new field adds complexity.
> >
> > Is there a "proper" way to do things? Any usual way of handling several
> > languages on a project? Any help is highly appreciated, thanks.
>
> This really depends on whether you have all content available in all
> languages. And if not, how you want to fall back to other languages. And
> how often you add new languages.
>
>
>
> Liz
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/[email protected]
>
>
--
Engel Sanchez
Solunion Group || Esfera Digital
www.solunion.com || www.esferadigital.com
E-mail: [email protected]