Managing Default System Locale

por | 18 diciembre, 2016

The default system locale is the locale in which the system will boot and run. In earlier releases of Oracle Solaris, the default system locale was configured in the /etc/default/init file. You can use the nlsadm command with the get-system-locale, list-locale, and set-system-locale subcommands. For more information, see the nlsadm(1M) man page.

To display the current default system locale, use the get-system-locale command,

# nlsadm get-system-locale

To list available system locales:

# nlsadm list-locale

To set the default system locale, use the set-system-locale command. For example, to set the default locale to fr_FR.UTF-8:

# nlsadm set-system-locale fr_FR.UTF-8

Locale Selection in the Installer

The initial default system locale is set during the installation. The Oracle Solaris installer is localized, so speakers of any of the core languages can navigate through the installation using their native tongue. The second screen of the Oracle Solaris 11 Live CD enables the user to choose the language that will be used during the installation. Only the ten core languages are available.

Figure 1  Language Choices in the Installer

image:Language Choices in the Installer

This language selection also determines the default language support and other data formats for the installed system.

Regardless of the default setting, all ten core locales are installed and available to users. You can change the default through the Automated Installer to broaden or narrow the language scope. Alternatively a custom Live CD can be generated by using the distro_const command. For more information, see the distro_const(1M) man page.

Note –  Localization for the text installer is available only through the serial console and not through the physical console.

Locale Selection in the Automated Installer

This section describes possible adjustments to Automated Installer manifests that alter the locale, keyboard, and timezone preferences.

Selecting Locales to Be Installed

The selection of locales to be installed is controlled by facets in the AI manifest. The <software><image> element contains the element facet, which has the following syntax:

<facet set="true|false">facet-name</facet>

The following sample manifest uses the facet elements to make sure that only the German (in Germany) and English (in the United States) locales and translations are installed on the target system.

<!DOCTYPE auto_install SYSTEM "file:///usr/share/install/ai.dtd.1">
	<ai_instance auto_reboot="true" name="ai-german">
	<software type="IPS">
				<!-- deselect all locales -->
				<facet set="false">facet.locale.*</facet>
				<!-- specify specific locales to install -->
				<!-- install German and English only -->
				<facet set="true"></facet>
				<facet set="true">facet.locale.de_DE</facet>
				<facet set="true">facet.locale.en</facet>
				<facet set="true">facet.locale.en_US</facet>

You can obtain a list of available locale facets from the system/locale package by issuing a command similar to the following example:

$ pkg contents -m system/locale | /usr/gnu/bin/grep -o facet.locale.[^\ ]* | sort -u

For more information about manifest creation, see the ai_manifest (4) man page.

Installing Non UTF-8 Locales

Although non UTF-8 (legacy) locales are not part of the default installation, they are still available in the system/locale/extra package. For example, to install the de_DE.ISO8859-1 locale, the package system/locale/extra has to be added to the AI manifest too.

	<software_data action="install">

Setting the Default System Locale, Keymap, and Timezone

You specify the default locale of a system installed through the Automated Installer in the System Configuration (SC) profile, as described in the service_bundle(4) and installadm(1M) man pages. For more information, see Providing Configuration Profiles in Installing Oracle Solaris 11.3 Systems.

The following example shows a system configuration profile that sets the default system locale to German.

<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="profile" name="system configuration">
	<service name='system/environment' version='1'>
		<instance name='init' enabled='true'>
			<property_group name='environment'>
				<propval name='LANG' value='de_DE.UTF-8'/>

Other international environment settings that were transitioned to the Service Management Facility (SMF) can be set in a similar fashion. The following example shows how to use the UK-English keyboard layout and the GMT timezone.

<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="profile" name="system configuration">
	<service name='system/keymap' version='1'>
		<instance name='default' enabled='true'>
			<property_group name='keymap'>
				<propval name='layout' value='UK-English'/>

	<service name='system/timezone' version='1'>
		<instance name='init' enabled='true'>
			<property_group name='timezone'>
				<propval name='localtime' value='GMT'/>