gettext-based localization Per Bothner 09 Apr 2002 04:58 UTC

The SRFI doesn't discuss any existing localization APIs.
I suggest it might be a better to come up with an API
that can work with existing tools and standards.  Specifically,
I would recommend an API that can be implemented using the
GNU gettext package.

I suggest these two functions:

(textdomain 'PACKAGE-NAME [LOCALE-DIR])
   Look for translations for the package named PACKAGE-NAME.
   The translation files are in LOCALE-DIR, which has an
   implemengtation-specific default.

(gettext "MESSAGE")
   Look for a translation for "MESSAGE".  If one is found,
   return it; otehrwise return "MESSAGE" unchanged.

Example:
   (textdomain 'hello-program)
   (display (format (gettext "Hello, ~a!") myname))

A trivial no-op implementation:
(define (textdomain . args) 'ignore)
(define (gettext msg) msg)
--
	--Per Bothner
xxxxxx@bothner.com   http://www.bothner.com/per/