Sorry Paul, I was talking to Michael. Just wanted to see how it was set because I've had similar errors but I put it down to OnApplicationStart only partially completing because of an error so some init code wasn't reached.
Adrian > -----Original Message----- > From: Paul Alkema [mailto:[email protected]] > Sent: 18 June 2009 14:53 > To: cf-talk > Subject: RE: Application Scope Problem > > > Code Example > <!--- Start set application in scope ---> > <cfset > application.translator=createObject("component",'packages.translator.tr > ansla > tor')> > <!--- End set application in scope ---> > > <!--- Start function ---> > <cffunction > access="public" > name="lookup" > returntype="string" > output="no" > hint="Returns the text found for the given language and > placeholder"> > > <cfargument name="placeholder" type="string" > required="yes"> > <cfargument name="language" > type="string" > required="yes"> > <cfset var tempText = ""> > <!--- Attempt to short-circuit the whole translation-in-memory > thing, and just do a lookup TVR 1/19/2008 ---> > > <cfquery name="getTranslation" datasource="mainDNS"> > SELECT * FROM translations > WHERE lang = <cfqueryparam CFSQLType="STRING" > value="#language#"> > AND placeholder = <cfqueryparam CFSQLType="STRING" > value="#placeholder#"> > </cfquery> > > <!--- If nothing found, and not already looking for English, > check > English ---> > <cfif (getTranslation.recordCount EQ 0) AND (language NEQ 'EN') > > > <cfquery name="getTranslation" datasource="mainDNS"> > SELECT * FROM translations > WHERE lang = 'EN' > AND placeholder = <cfqueryparam CFSQLType="STRING" > value="#placeholder#"> > </cfquery> > </cfif> > > <cfif getTranslation.recordCount NEQ 0 > > <!--- Replace any variables in the text, marked by <% %>, > with values passed to the function as var1, var2, etc. ---> > <cfset tempText = getTranslation.content> > <cfloop collection="#arguments#" item="varName"> > <cfif ucase(left(varName, 3)) eq "VAR"> > <cfset tempText = replaceNoCase(tempText, "<% > #varName# > %>", arguments[varName])> > </cfif> > </cfloop> > </cfif> > <cfreturn temptext> > </cffunction> > <!--- End function ---> > > <!--- Start Usage ---> > <cfoutput> > #application.translator.lookup(placeholder="testtext.69EE0E03",language > =requ > est.current_lang)# > </cfoutput> > <!--- End Usage ---> > > -----Original Message----- > From: Adrian Lynch [mailto:[email protected]] > Sent: Thursday, June 18, 2009 9:43 AM > To: cf-talk > Subject: RE: Application Scope Problem > > > How are you setting the component in the app scope? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323636 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

