[plt-scheme] Localization and namespace problem

From: Erich Rast (Erich.Rast at t-online.de)
Date: Wed Oct 16 01:38:37 EDT 2002

I've implemened a simple localization system with hash-tables and an 
API like that:

(current-language "English")
(text SampleText)                       ; sampletext is a symbol, text 
a define-syntax macro
==> "Hello world!"

But there's a tricky problem I cannot solve.

I intend to implement plugins and external commands as well, probably 
by using modules and/or classes. Each plugin needs a localization 
provided by the plugin author. I don't know in advance what texts an 
author will localize and what symbolic constants he will use for that, 
and the author doesn't know which symbolic constants other plugin 
authors or I myself will use. Arbitrary prefixes can of course collide 
as well.

Because a plugin author might neglect certain languages that users 
might want to support later, I also need a way to export the plugin 
localizations for global user-editing, and the plugin needs to 
re-import them for its own use later.

So when a plugin's localization constants are in the "global" namespace 
for enhancement, adding new languages, etc. they probably need some 
plugin-identifier prefix or another way to avoid collisions. But inside 
the plugin, the plugin author should be able to just refer to them like 
in (text SampleText) no matter for which localization SampleText stands 
in other plugins or the main program. To make things more complicated, 
classes using localizations in their definition get exported into the 
main application, of course, but the text macro should evaluate to the 
localization given by the plugin author's definition of symbolic 

Any ideas?



Posted on the users mailing list.