| Extracted from Pike v7.8 release 700 at 2013-06-08.

[Top]
Locale

# Module Locale

Description

  The functions and classes in the top level of the Locale module implements a dynamic localization system, suitable for programs that needs to change locale often. It is even possible for different threads to use different locales at the same time.

  The highest level of the locale system is called projects. Usually one program consists of only one project, but for bigger applications, or highly modular applications it is possible for several projects to coexist.

  Every project in turn contains several unique tokens, each one representing an entity that is different depending on the currently selected locale.

Example

      // The following line tells the locale extractor what to
        // look for.
        // <locale-token project="my_project">LOCALE</locale-token>
        // The localization macro.
        #define LOCALE(X,Y) Locale.translate("my_project", \
          get_lang(), X, Y)
        string get_lang() { return random(2)?"eng":"swe"; }
        int(0..0) main() {
          write(LOCALE(0, "This is a line.")+"\n");
          write(LOCALE(0, "This is another one.\n");
          return 0;
        }