Yeah, if the site is mostly static content, that works, but if it's a
dynamic application, you probably won't want to duplicate the display layer
in all the different layers.

Victor, your approach is good and makes sense, however, instead of doing all
of that in your Application.cfc, you should probably make a CFC to handle
each language. Like this:

application.languageContent.EN =
createobject("component","language").init("en");
which will run your queries and store them in the variables scope for that
CFC. Then, instead of trying to reference the applicaiton scope's spot for a
specific piece of content, find a way to automate that by calling a simple
function, like #application.languageContent[session.lang].getContent("pagename",
"area")#

And, to be smarter, make a variables-scoped function:

function showcontent(area) {
  return application.languagecontent[session.lang].getContent(
cgi.script_name, arguments.area);
}

so it's just #showcontent("area")#

anyways, just some ideas. take 'em if you like 'em.

-nathan strutz
http://www.dopefly.com/

On 10/1/06, Snake <[EMAIL PROTECTED]> wrote:
>
> Depends if your site is database driven and needs to be DB driven, if it
> is,
> store multiple langauge versions of all content with a languageID,
> otherwise
> store flat files in language folders.
>
> E.g.
>
> Mysite/uk
> MySite/FR
>
> When someone enters the site, ask them to choose the language,a nd stor
> ethe
> ID in a cookie.
>
> Russ
>
> -----Original Message-----
> From: Victor Moore [mailto:[EMAIL PROTECTED]
> Sent: 01 October 2006 19:30
> To: CF-Talk
> Subject: Localization best practices
>
> Hi,
>
> I am struggling to determine what is the best option for the following:
> If a site has to provide multiple languages, how would one go about
> displaying the language info in selects.
>
> Ex the information is stored in the db like:
> table_1
> id int
> language_id tinyint
> lang_string nvarchar [40]
>
> I came up with two possible scenarios (pseudo code):
> 1.   In Application.cfc
>      <cfquery name="q" datasource...>
>           select * from table_1 order by id, language_id
>     </cfquery>
>     stick it in applications scope
>     <cfset application.q = q />
>
> Then on each page where where language dependent info needs to be
> displayed
> run a QofQ:
>
> <cfquery name="q" dbtype="query".>
>           select * from q
>           where language_id=#lang_id#
>     </cfquery>
>    display it ...
>     <cfselect name=".." query="q" ...>
> </cfselect>
>
> 2. In Application.cfc loop through the available languages and stick each
> language in it's own application scope query <cfloop index="i"...>
>     <cfquery name="q#i#" datasource...>
>           select * from table_1 where language_id = #i#
>     </cfquery>
>     stick it in applications scope
>     <cfset application.q#i# = q#i# />
>
> </cfloop>
>
> and then:
>
> <cfselect name=".." query="application.q#lang_id#" ...></cfselect>
>
> where lang_id is the user selected language
>
> What do you think? Are there any better solutions?
>
> Thanks
> Victor
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254943
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to