Ok guy's, here is a description of how I solved this problem for me. Firstly I
have a site that contains approxiamately 1750 pages. These pages are all
grouped together inside Directories i.e. 'Players', 'Competitions', etc. Each
of these Directories also contain a Directory called 'Language'. The 'Language'
Directorycontains a number of XML files called 'English.xml', 'French.xml',
etc. One XML file per language. All of the text in my CFM pages is replaced
with the following;
#translate("LABEL_NAME","PAGE_NAME","FOLDER_NAME")#
The translate function lives in my application.cfm page and is as follows;
<cffunction name="translate" output="no">
<cfargument name="item" required="yes" type="string">
<cfargument name="whatpage" required="yes" type="string">
<cfargument name="folder" required="yes" type="string">
<cfparam name="language" default="english">
<cfxml variable="pageFile" casesensitive="no"><cfif NOT
IsDefined("onceonly")><cfsavecontent variable="onceonly"><cfinclude
template="#folder#/language/#language#.xml"></cfsavecontent></cfif><cfoutput>#onceonly#</cfoutput></cfxml>
<cfset arr = XMLSearch(pageFile, "/page/[EMAIL
PROTECTED]'#arguments.whatpage#']/#arguments.item#")>
<cftry>
<cfreturn arr[1].xmltext>
<cfcatch type="expression">
<cfreturn "???MISSING TEXT???">
</cfcatch>
</cftry>
</cffunction>
Each of my users have a language preference specified that is held within the
session scope, this variable is used to decide which XML file to include. The
XML file is searched for the required label and the text is then returned to
the page. One CFM page, multiple languages.
This works perfectly for me and is very efficient however I wrote this some
time ago and I am in the process of redoing it to see if I can make it any
better by possibly using cached SQL queries or using the application scope, to
be decided.
Now the tricky part, maintaining the text. ALL of my English text is stored
inside of a SQL database. I have written an administration interface that
exposes all of the English text to the screen in small manageable chunks that
allows an interpreter to translate the text for me. Once the text is translated
then it is simply a click of a button and a CFC that I wrote generates all of
the Language XML files for a particular directory. Anytime that I want to add
new text I simply add it via my administration interface which then makes it
available for translation. If a translation for a certain piece of text doesn't
yet exist then the English version is displayed by default, if a piece of text
is missing completely then this is flagged on the site.The best part of all of
this is I can add new languages and generate XML files at a click of a button!
Unfortunately all of this code is packaged as part of a much larger
administration site and it will take me a long time to make it a seperate stand
alone interface but I do intend to do that one day.
With regards to the actual translation, this is where I am very lucky, all of
my translation is carried out by someone of the nationality that is required.
Therefore I always have interpreters on hand in places such as Spain, France,
Germany, etc who work for me to ensure that nothing gets lost/added in
translation!
This is just one way of doing it, I am very interested in this discussion as I
would like to try any new ideas/suggestions for improving this.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:203932
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54