Entry
How do I make my store bilingual?
May 8th, 2000 13:00
Mike Potter, The Canadian Curling Association
I was recently asked by the Canadian Curling Association to make their
entire site bilingual. The biggest part of this was doing the store,
which is using FreeTrade. Here is what I did:
1. I made a second DNS entry for "francais.curling.ca". This just
pointed to "www.curling.ca" but allows me to know if they want the page
served in English or in French.
2. I had the translator translate most of the /language/english file
into french, except for the admin stuff. (Those translators are
expensive!) Leon tells me the file is now available in the download or
at least in the CVS.
3. I added the following code to global_settings (near the bottom):
if ($HTTP_HOST == "francais.curling.ca") {
define('LANGUAGE_DEF', 'french');
include("$Application_Root/modules/language/" .
LANGUAGE_DEF);
} else {
define('LANGUAGE_DEF', 'english');
include("$Application_Root/modules/language/" .
LANGUAGE_DEF);
}
4. I added fields called FrenchName and FrenchDescription to the
database tables item and department.
5. I added the following code on /screens/items
and /screens/departments/ where appropriate (try searching for SELECT
to find all the occurences):
if (LANGUAGE_DEF == "french") {
$Query = "SELECT FrenchName as Name FROM department WHERE ID =
$department";
} else {
$Query = "SELECT Name FROM department WHERE ID = $department";
}
6. I added the following code to index.php3:
if ($HTTP_HOST == "francais.curling.ca") {
define('SERVER_NAME', 'www.curling.ca');
} else {
define('SERVER_NAME', 'francais.curling.ca');
}
I don't know if this is still in index.php3, but you'll have to find
where SERVER_NAME is defined and change it, otherwise the links will
not work properly.
7. That's it. If you want to display or change other text, do a simple
if statement with
if (LANGUAGE_DEF == "french") {
do this.
} else {
do this.
}
I hope this helps. If you have questions, email me at iam@inthehack.com
or check out the CCA's store at www.curling.ca/shop