[thelist] CF: Multiple Language Solution Tips?

rudy r937 at interlog.com
Sat Feb 1 08:40:50 CST 2003


> Do you have any good tips, or urls or pointers that you might care to
share?

a commerce solution will employ session variables, nu? (as joe clark would
say)

keep the current user's language pref in a session variable

pull everything out of the database using the user's language pref in a
WHERE condition, e.g.

      select productid, productdescr from productdescriptions
         where productid=#form.product# and lang=#session.lang#

make "lang" part of every table's primary key that varies by language

in the product example, you might want a "main" product table for prices and
other language-independent columns, then a separate product description
table, in a one-to-many relationship, whereas in a single language model,
the description column would be included in the main products table

this will mean some queries may require a join where in a single language
model they didn't

for error messages and stuff which gets used frequently, retrieve them
all -- all messages for all languages -- using a very long term cached
query, and then for a given user, use query-of-query to get a particular
error message using her language choice to pick which row in the cached
query


rudy




More information about the thelist mailing list