Another, more extensible approach, is to store all your text in the
database.  If you give each piece of text a reference number, plus a code
for language.
eg.
tblLanguage
===========
ID      Language
1       English
2       Spanish
3       Italian

tblContent
==========
ID      LanguageID      ContentText
1       1               Welcome to my Application
1       2               Recepci�n a mi aplicaci�n
1       3               Benvenuto alla mia applicazione


You can write a tag that picks up the users prefered language from
cookies/client variables/user preferences in the applications database and
then picks up the appropriate content from the content table.

eg.
DisplayContent.cfm
<cfif IsDefined("cookie.languageID")>
        <cfset attributes.languageID = cookie.LanguageID>
<cfelse>
        <cfparam name="attributes.languageID" default=1>
</cfif>

<Cfquery datasource="request.dsn" name="dspContent">
SELECT ContentText
FROM tblContent
WHERE ID = #attributes.objectid#
AND LanguageID = #attributes.languageID#
</cfquery>

<cfif dspContent.recordcount is 1>
        <cfoutput>#dspContent.ContentText#</cfoutput>
</cfif>

So

        <cf_displaycontent objectid="1">

would give you

        Welcome to my Application

if your language is set to English or not set at all.


Of course I've just written this off the top of my head as I've written this
email, so chances are this won't work straight offf, but you get the
idea....

Oh and its definately worth including some query caching in
displaycontent.cfm

Regards

Stephen

> -----Original Message-----
> From: BOROVOY Noam [mailto:[EMAIL PROTECTED]]
> Sent: 10 May 2001 09:57
> To: Fusebox
> Subject: Generic wrapper page [WAS: RE: Advantages of use cfid and
> cftoken ?]
>
>
> We provide a multilingual web site as well, and have chosen a slightly
> different approach - a generic wrapper page.
>
> This solves other issues as well:
> - Statistics - you can see access by fuseaction and by language.
> - Bookmarks keep the language
>
> Create a directory - all links will be to this directory, it has one file
> for each language and fuseaction. All files are identical, just the names
> are different.
> An example:
> EN_Login.cfm
> ES_Login.cfm
> FR_Login.cfm
> ....
> EN_Help.cfm
> ....
>
> The wrapper file contents:
>
> <!--- Name: Generic Wrapper page
> Description:
> Takes filename and based on it calls the index file with correct language
> and fuseaction
> Parameters:
>
> written: 15/07/1999 NB
> --->
>
> <CFSET variables.TemplateName = GetFileFromPath(GetCurrentTemplatePath())>
> <CFSET request.DisplayLanguage = listFirst(variables.TemplateName, "_")>
> <CFSET attributes.FuseAction = listGetAt(variables.TemplateName, 2, "_.")>
>
> <CFINCLUDE template="../index.cfm" >
>
>
> HTH,
> Noam
>
>       ----------
>       From:  Toni Trape [SMTP:[EMAIL PROTECTED]]
>       Sent:  Wednesday, 09 May 2001 9:16
>       To:  Fusebox
>       Subject:  RE: Advantages of use cfid and cftoken?
>
>       OK, i do that but the question is where i put the language flag? In
> a
>       session variable, in a client variable? client variable stored into
> a
>       cookie? client variable and passed in the URL all time?
>
>       This is what i don't know.
>
>       Toni
>
>       At 10:38 08/05/01 -0600, you wrote:
>       >No, you set a language flag to tell the db which data to select.
> Never
>       >duplicate structure if you can help it ... just pull the
> appropriate
>       >information.
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to