Here is the code:


<cfset Application.labels = StructNew()>

<cfloop query="dbLanguages">
<cfset Application.labels[dbLanguages.language] = StructNew()>
</cfloop>

<cfloop query="dbLabels">
<cfset Application.labels[dbLabels.language][dbLabels.labelname] = dbLabels.value>
</cfloop>


At 12:39 PM 1/16/01 -0500, Perez, Bismark wrote:
>Hi Peter,
>
>on your example you use: 
>
>Application.labels['en']['geninfo'] = "General Information"
>
>how where you able to create a multilevel structure, I though you can only
>create a single level (exp. Application.labels['getinfo'] = "General
>Information") where "labels" will be the name of the structure, can you help
>me understand how you accomplish this?
>
>
>Bismarck Perez
>
>
>-----Original Message-----
>From: Peter Theobald [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, January 16, 2001 10:30 AM
>To: CF-Talk
>Subject: Re: big translation
>
>
>One of our sites, http://www.sponsorclick.com is translated into 5 languages
>so far (more coming).
>
>A quick synopsis of our method:
>
>We had to translate three things: text in the pages, values from the
>database, and images in the pages (some images have words in them).
>
>1) Text: 
>
>In Application.cfm we load a large structure into an Application variable
>(only has to load into memory ONCE) with all of the different text messages
>in each language we support. Each piece of text (we call a 'label') has a
>name and a value for each language. One example would be:
>
>Application.labels['en']['geninfo'] = "General Information"
>Application.labels['fr']['geninfo'] = "Informations générales"
>Application.labels['de']['geninfo'] = "Allgemeine Informationen"
>
>This structure is loaded from the database only once when the server starts
>up.
>(Of course we have admin pages to edit these values, and a facility to
>import Excel spreadsheets for bulk updates)
>We currently have over 16,000 values in this table in the database.
>
>Each time Application.cfm is run, we check the user's current language and
>assign a structure to the appropriate language set:
>variables.label = Application.labels[#language#]
>*note: this is making a POINTER to Application scope data in a local
>variable. Making a pointer is VERY fast. Copying the values would be much
>slower. This local variable, label, has to be locked as if it was an
>Application variable (because it really is). The only reason we didnt use
>Application.label is to save typing later on.
>We use automatic read locking on the Application scope to do this for all
>accesses to Application data.
>
>Now each instance on the page that needs to display text uses the variable:
>
>< td>< b>#label.geninfo#< /b>< /td>
>
>2) Database values:
>
>All database values (mostly choices for select lists) come from a table that
>is generic enough to be used for all multilingual data:
>
>Table multilingual:
>  list varchar(40)
>  name varchar(40)
>  order int
>  value text    <= This is a LARGE TEXT field that can hold more than 256
>characters, although most values are < 100 characters
>
>3) Images:
>
>All URLs on the site have the current language prepended to them, eg:
>/en/index.cfm, /fr/index.cfm, /de/index.cfm, etc.
>The Apache web server has mappings set up to remove the language for cfm and
>htm files so that /en/index.cfm is actually the file /index.cfm.
>
>Image URLs are simple relative URLs such as: 'IMG SRC=images/file.jgp'. The
>full URL would resolve to /en/images/file.jpg or /fr/images/file.jpg for
>example.
>The Apache web server also has mappings for /en/images =>
>/languages/images/en/ and /fr/images => /languages/images/fr/ and so forth
>so the images will actually come from a language specific image directory
>
>
>At 02:10 PM 1/16/01 +0100, Javalenzuela wrote:
>>Hi guys,
>>
>>I work in a Internet company (startup?) and we have +-600 CFM files  (some
>>with fusebox).
>>Now, we are thinking to switch the website in 2+ languages (we are in
>>Europe) but we don't know what is the best
>>way to do this. I mean, something with few performance penalties and
>>flexible enough to have several languages later (at beggining we only want
>>2 languages)
>>
>>some questions:
>>- May I use BD to choose and retrieve all the text messages ?
>>- May I enhance the pages with more intelligente in order to they can
>>translate in each web request ?
>>- what about to copy and translate each page in a off-line mode ?
>>
>>Anyone has some experience in this matter?
>>Do you know links or URL about ?
>>
>>Any help is useful... (i want to make the rigth decision)
>>
>>thanks in advance,
>>
>>~Juandres
>>
>>
>>
>>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to