Hi Tero,

> Actually I'm pretty close to what Erki already had in mind. If
> there is some obivious problems I'd like to hear about it..
>
> 1. example of actual dictionary in XML format
> 2. Dictionary is processed once (when server is restarted) or
> when it's modified into memory using ColdFusion structures for
> simple and efficient data access.

So if you parse it into CF structures, then why not just use WDDX to
store the data? WDDX was designed for this. My application.languages
structure looks like this:

application.languages
    et
        fbx_settings.cfm
            site_name
            support_email
        dsp_defaultLayout.cfm
            meta_description
            meta_keywords
        member/dsp_login.cfm
            login_error
    en
        fbx_settings.cfm
            site_name
    ...

And that is saved as WDDX like this:

<wddxPacket version='1.0'>
<header></header>
<data>
    <struct>
        <var name='EN'>
            <struct>
                <var name='fbx_settings.cfm'>
                    <struct>
                        <var name'site_name'>
                            <string>My Site Name</string>
                        </var>
                    </struct>
                </var>
            </struct>
        </var>
        <var name='ET'>
            ...
        </var>
    </struct>
</data>
</wddxPacket>

> 3. During each request selected language structure is copied to
> Request scope. This is fast because it's simply memory copy.

The language WDDX file for the site I'm working on, is over 800 KB,
and that's just two languages. Since one request needs only a fraction
of all that, then I decided not to copy the whole language into
request scope, instead I use my langcopy() function on separate pages
and it copies usually only 10 tokens or so. For the full page request
I usually use only maximum of 50 tokens out of 3500+. This lets me keep
CF memory usage down when there are a lot of concurrent requests.

> 4. When site is displayed all translated items are displayed using
> pre-prosessed dictionary structure. Same principle is used with images
> where both textual alternative and image file has to be specified.
> 
> <CFOUTPUT>#Request.dict.home#</CFOUTPUT>
> <CFOUTPUT><IMG SRC="#Request.image.home.src#"
> ALT="#Request.image.home.alt#"></CFOUTPUT>

What if you forgot to add that image.home.alt element? CF will throw an
error. My #lang('token_name')# solution returns "[lang:token_name]" when
it can't find it. I think it's better than throwing a CF error.

> 5. Larger but static text block are stored as separate files and
> conditionally included in fusebox switch-block:

I do that too but client var in dynamic include instead of switch:

<cfinclude template="dsp_information_#client.lang#.cfm">

.erki

==^================================================================
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9
Or send an email to: [EMAIL PROTECTED]

T O P I C A -- Register now to manage your mail!
http://www.topica.com/partner/tag02/register
==^================================================================

Reply via email to