1 Using String Constants
string-constant
string-constants
this-language
all-languages
set-language-pref
2 Adding String Constants
3 Language Environment Variables
Version: 5.1

String Constants: GUI Internationalization

This library provides the facility for multiple languages in DrRacket’s GUI.

1 Using String Constants

 (require string-constants)

This form returns the string constant named name.

This form returns a list of string constants, one for each language that DrRacket’s GUI supports.

This form returns the name of the current language as a symbol.

This form returns a list of symbols (in the same order as those returned from string-constants) naming each language.

(set-language-pref lang)  void?
  lang : string?
Sets the language for the next run of DrRacket to lang, which must be a symbol returned from all-languages. Does not affect the running DrRacket.

2 Adding String Constants

 (require string-constants/string-constant-lang)

To add string constants to DrRacket, see the files:

Each file has the same format. They are each modules in the string-constants/string-constant-lang language. The body of each module is a finite mapping table that gives the mapping from the symbolic name of a string constant to its translation in the appropriate language.

The "english-string-constants" is considered the master file; string constants will be set there and translated into each of the other language files. In addition, the "english-string-constants.ss" file should contain hints about the context of the strings whose symbol name might not be clear.

3 Language Environment Variables

If either of these environment variables are set, DrRacket shows you, during startup, which string constants are not yet defined for each language.

You can also specify which languages you are interested in. If either environment variable is bound to a symbol (as interpreted by read) you see only the corresponding language’s messages. If either one is bound to a list of symbols (again, as interpreted by read) you see the messages for all the languages in the list. If either is bound to anything else, you see all of the languages.

The PLTSTRINGCONSTANTS environment variable takes precedence of the STRINGCONSTANTS environment variable.