This library provides the facility for multiple languages in DrRacket’s GUI.
|(require string-constants)||package: string-constants-lib|
(call-with-current-language sc-language thunk) → any sc-language : string-constant-langauge? thunk : (-> any)
This function is designed to facilitate testing of libraries that use string constants, so they can work regardless of the user’s language setting.
To add string constants to DrRacket, see the file "private/english-string-constants.rkt" and the other string constants files in the "private" directory. (Some string constants files that have a less permissive license are also available on the pkg server in the string-constants-lib-lgpl pkg.)
Each file has the same format. They are each modules in the string-constants/private/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. Multiple string constants that appear together are implicitly concatenated.
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.rkt" file should contain hints about the context of the strings whose symbol name might not be clear.
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 over the STRINGCONSTANTS environment variable.
The PLTSTRINGCONSTANTSLANG controls the language choice, overriding the default saved in the preferences file. If it is not set to one of the languages in the result of all-languages, it is ignored.