Previous Next Contents Index Doc Set Home


Localization Support

C


Support for languages other than English is described in this Appendix.


Native Language Support

This version of C++ supports the development of applications using languages other than English, including most European languages. As a result, you can switch the development of applications from one native language to another.

This C++ compiler implements internationalization as follows:

Locale

You can enable changing your application from one native language to another by setting the locale. Doing so changes some aspects of displays, such as date and time formats.

For information on this and other native language support features, read Chapter 6, "Native Language Application Support," of the System Services Overview for Solaris software.

Compile-Time Error Messages

The compile-time error messages are on files called source catalogs so you can edit them. You may decide to translate them to a local language such as French or Italian. Usually, a third party does the translating. Then you can make the results available to all local users of C++. Each user of C++ can choose to use these files or not.

Localizing and Installing the Files

Usually a system administrator does the installation. It is generally done only once per language for the whole system, rather than once for each user of C++. The results are available to all users of C++ on the system.

1. Find the message text files.

The file names are:

2. Edit the message text files.

a. Make backup copies of the files.

b. In whatever editor you are comfortable with, edit the files.

The editor can be vi, emacs, textedit, and so forth.

Preserve any existing format directives, such as %1, %2, %3, and so forth.

c. Save the files.

3. Generate the message database catalogs from the message text files.

The compiler uses only the formatted message database catalogs. Run the gencat program to create the database files.

a. Generate the SUNW_SPRO_SC_ccfe.cat message database from the SUNW_SPRO_SC_ccfe.msg text file using gencat:

demo% gencat SUNW_SPRO_SC_ccfe.cat \        
                                 SUNW_SPRO_SC_ccfe.msg

Do this for each changed .msg file.

4. Make the message database catalogs available to the general user.

Either put the catalogs into the standard location or put the path for them into the environment variable NLSPATH.

a. Put the catalogs in the standard location.

Put the files into the directory indicated:

/opt/SUNWspro/lib/locale/lang/LC_MESSAGES/

where lang is the directory for the particular (natural) language. For example, the value of lang for Italian is it.

b. Set up the environment variable.

Put the path for the new files into the NLSPATH environment variable.
For example, if your files are in /usr/local/MyMessDir/, then use the following commands.

In a sh shell:

demo$ NLSPATH=/usr/local/MyMessDir/%N.cat
demo$ export NLSPATH

In a csh shell:

demo% setenv NLSPATH  /usr/local/MyMessDir/%N.cat

The NLSPATH variable is standard for the X/Open environment. For more information, read the X/Open documents. See also gencat(1) and catgets(3C) for more information on message catalogs.

The CC driver sets up the environment variable NLSPATH before invoking the compiler ccfe. The existing value of NLSPATH, if any, is prepended to the standard location. In the above example, before invoking ccfe, the CC driver will set NLSPATH to:

/usr/local/MyMessDir/%N.cat: \ /opt/SUNWspro/lib/locale/%L/LC_MESSAGES/%N.cat

Using the File After Installation

You use the file by setting the environment variable LC_MESSAGES. This setup is generally done once for each developer.

Example: Set the environment variable LC_MESSAGES, assuming standard install locations, and the messages are localized in Italian:

In a sh shell:

demo$ LC_MESSAGES=it
demo$ export LC_MESSAGES

In a csh shell:

demo% setenv  LC_MESSAGES it

If you want to use the localized messages for libcomplex and libtask, then you must set the environment variable NLSPATH before executing your program. You should do this even if you have installed the localized catalogs in the standard location.




Previous Next Contents Index Doc Set Home