JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
International Language Environment Guide     Oracle Solaris 11 Information Library
search filter icon
search icon

Document Information


1.  Introduction

2.  Unicode and UTF-8 Locale Support

3.  Working with Languages and Locales

4.  Desktop Keyboard Preferences and Input Methods

5.  Configuring Fonts

6.  Advanced Topics

Code Set Conversion

iconv Utility

International Components for Unicode

uconv Utility

File Examiner (fsexam)

Auto Encoding Finder (auto_ef)

Internationalized Domain Names Support

GNU IDN Library

JPNIC idnkit Library

Printing Enhancement

mp utility

Interoperability with Other Platforms

NFS Server Considerations

File System Considerations

Archives Containing Non-ASCII Filenames

Creating a Custom Locale

Creating a New Locale Based on a System Locale

How to Create a Custom Locale

Creating a Locale From Scratch

A.  Available Locales


Creating a Custom Locale

This section describes how to create a custom locale based on an existing locale delivered with the system using localedef(1).

Note - Only the locales provided by Oracle are supported. A badly formed locale can be a source of failures.

Creating a New Locale Based on a System Locale

To customize and thus create a new locale from existing locales, you need to prepare at least three locale definition source files:

The locales provided by the system have their respective locale definition data files available in source/locale/localedef package. These can be useful when only a slight change in existing system locale is required.

How to Create a Custom Locale

  1. Install the necessary packages by typing the following command:
    $ sudo pkg install system/header source/locale/localedef
  2. Ensure you have the Oracle Solaris Studio C compiler in your PATH:
    $ export PATH=<oracle-studio-path>/bin:$PATH
  3. Prepare the workspace by using the following commands:
    $ mkdir mynewlocale
    $ cd mynewlocale 
    $ mkdir amd64 
    $ cp /usr/lib/locale/common/ . 
    $ cp /usr/lib/locale/common/amd64/ amd64/ 
    $ cp /usr/lib/localedef/src/charmaps/UTF-8.charmap \
    /usr/lib/localedef/src/extensions/UTF-8.x \
    /usr/lib/localedef/src/locales/fr_FR.UTF-8.src .
  4. Make changes to the localedef, charmap, or extension source files as necessary.
  5. Build the 64-bit locale object.
    $ localedef -m lp64 -f UTF-8.charmap -x UTF-8.x -i fr_FR.UTF-8.src \
    -L "-R\\\$ORIGIN/../../common -Bdirect -M /usr/lib/ld/map.pagealign \
    -M /usr/lib/ld/map.noexdata" fr_FR.UTF-8@custom
    $ mv amd64/
  6. Build the 32-bit locale object.
    $ localedef -m ilp32 -f UTF-8.charmap -x UTF-8.x -i fr_FR.UTF-8.src \
    -L "-R\\\$ORIGIN" fr_FR.UTF-8@custom
  7. Install the custom locale.
    $ sudo mkdir -p /usr/lib/locale/fr_FR.UTF-8\@custom/amd64 
    $ sudo cp fr_FR.UTF-8\ /usr/lib/locale/fr_FR.UTF-8\@custom/ 
    $ sudo cp amd64/fr_FR.UTF-8\ /usr/lib/locale/fr_FR.UTF-8\@custom/amd64/
  8. Type the following command to start using the locale:
    $ export LANG=fr_FR.UTF-8@custom

Creating a Locale From Scratch

Creating a locale from scratch is something that is rarely needed. The same approach as in the Creating a New Locale Based on a System Locale can be used to create a locale from scratch. Refer the localedef(1), locale(5), extensions(5) and charmap(5) man pages for more detailed information on locales and options available for the localedef, charmap and extension source files.