|
Subject: Re: stylesheets ans NLS From: "Russell Steven Shawn O'Connor" <roconnor@xxxxxxxxxxxx> Date: Mon, 17 Apr 2000 07:45:33 -0400 (EDT) |
On Mon, 17 Apr 2000, Jany Quintard wrote:
> 1 - hard code the tests where labels are used :
>
> (let (codlang (entity-text "xoLang"))
> .../...
> (literal
> (if (equal? codLang "fr")
> "Table des matières"
> (if (equal? codLang "en")
> "Table of contents"
> (debug (string-append "No translation for " codLang)))))
> .../...
> )
> It is simple be not very good, not easy to maintain etc...
This is a similar idea, but a little more elegant:
(define Table-of-contents-Strings
'((en "Table of contents")
(fr "Table des matières")
) )
.../...
(define (look-up-string lang table)
(if (assoc lang table)
(assoc lang table)
(debug (string-append "No translation for " (symbol->string
codLang))
) ) )
.../...
(let (codlang (string->symbol (entity-text "xoLang")))
.../...
(literal (look-up-string codlang Table-of-contents-Strings))
.../...
)
All your association lists can be kept in a different file, and imported
using an entity.
This is all off the top my my head, so it may need tweeking, or may not
work at all.
Good Luck.
--
Russell O'Connor roconnor@xxxxxxxxxxxx
<http://www.undergrad.math.uwaterloo.ca/~roconnor/>
``Paradoxically, a refusal to `put a monetary value on life' means that
life is often undervalued.'' -- Artificial Intelligence: A Modern Approach
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| stylesheets ans NLS, Jany Quintard | Thread | Re: stylesheets ans NLS, Russell Steven Shawn |
| stylesheets ans NLS, Jany Quintard | Date | Re: stylesheets ans NLS, Russell Steven Shawn |
| Month |