Hey Ed,
Putting all the languages in 1 file, instead of separate files, and loading
them all onApplicationStart, is already an improvement to loading a language
on each SessionStart as I was about to do. So thanks for that. And using a
generic getter (or dictionary lookup, if you prefer) now makes complete
sense - especially since I don't foresee any special GET cases popping up.
So does your XML file look like this:
<root>
<english>
<text name="Submit">Submit</text>
<text name="Save">Save</text>
</english>
<french>
<text name="Submit">Soummission</text>
<text name="Save">Sauve Garder</text>
</french>
</root>
How do you go about breaking up your text? For example, lets say you had a
big paragraph of text. It may seem natural to make that a single item in
your XML, but lets say one word in the paragraph had to be bold. Would you
now have the 3 items for the paragraph, 1 for the first half, 1 for the bold
word and a third item for the second half? Or would you include formatting,
such as <strong> and <em>, within your XML? What if the design changes or
all of a sudden another word had to be italicized? How do you go about
managing/separating the presentation from the content?
Cheers,
Baz
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Ed Griffiths
Sent: December 19, 2005 5:30 AM
To: [email protected]
Subject: RE: [CFCDev] CFC that reads XML
Hi Baz,
We use a single UTF-8 XML translations file that contains a node for each
language (currently 8 languages, including Russian/cyrillic and
Japanese/kanji translations). The translations XML file is parsed and loaded
into server scope on application startup to ensure that it's accessible to
many applications.
The language handler CFC contains one generic pseudo-getter that accepts a
Language argument ('en', 'fr', 'jp' etc) and an Item ('submit', 'save',
'search results' etc) argument. Having a generic getter means that we only
have to modify the XML file, not the CFC, if we add a new translation -
handy if you're updating your translations on a regular basis, as we do.
Cheers,
Ed
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Baz
Sent: 18 December 2005 06:10
To: [email protected]
Subject: [CFCDev] CFC that reads XML
Hi,
If you were implementing multiple languages and wanted to store all your
text in multiple XML files (English.xml, French.xml, etc.) and each XML file
had a structure like this:
<root>
<resource name="ContactUs.PageTitle">Contact US</resource>
<resource name="ContactUs.BodyTitle">Feel free to contact us</resource>
...
</root>
Would you create 1 CFC that loads the appropriate language file, and
contains a getter FOR EACH text element (hundreds of getters)? Or would you
make 1 generic getter that takes as an argument the full resource name?
Is this generally a good way to go about implementing multiple languages?
Cheers,
Baz
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
________________________________________________________________________
This e-mail has been scanned for all viruses by MessageLabs.
________________________________________________________________________
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]