CLIM mail archive

[Prev][Next][Index][Thread]

Multilingual (French, English...) applications - any hints?



I wonder whether somebody has been confronted with writing
multi-lingual applications using CL and CLIM. There are three
different kinds of strategies as far as I can see:

(1) Compile time conditionalization with #+ macros
(2) Load time switching using load-time-value (see example below)
(3) Run time switching by calling a function

Solution 2 is good enough for us. 3 may be less efficient an take more
space too. 

There are other issues involved, such as the question whether to put
strings in lookup tables (makes code smaller, but maybe not as readable)
or leave them in the code.

==> Could somebody do me the favor and tell:
   - whether the code below is the corrrect thing to do? 
   - whether there are smarter solutions for our kind of problem
   - give any other useful comment

  THANX A LOT  - Daniel

----- cut here ---
;;; -*- Mode: LISP; Syntax: Common-lisp; Package: clim-user; Base: 10 -*-

;; (defvar *language* nil)
;; (setq *language* 'e)

(defun select-language (list)
  (if (eq *language* 'f)
      (cadr list)
    (car list)))

(defmacro ll (&rest list)
  `(load-time-value (select-language (quote ,list))))

(defun test ()
  (format t "~s" (ll "English string" "French string")))

-------------------

Daniel K.Schneider, TECFA (Educational Technologies and Learning)
Faculte de Psychologie et des Sciences de l'Education, University of Geneva,
9 route de Drize, 1227 Carouge(Switzerland),
Phone: (..41) 22 705 9694, Fax: (..41) 22 342 89 24

Internet:   schneide@divsun.unige.ch  (and various national nets)    | if reply
X400:       S=schneide;OU=divsun;O=unige;PRMD=switch;ADMD=arcom;C=ch | does not
uucp:       mcvax!cui!divsun.unige.ch!shneider                       | work, try
BITNET:     schneide@cgeuge51                                        | one of
DECNET:     UGUN2A::SCHNEIDE (local Swiss)                           | these





Follow-Ups:

Main Index | Thread Index