The Package Locales
Author: JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor

Ada Reference Manual — Legal Information

# A.19 The Package Locales

1/3
A locale identifies a geopolitical place or region and its associated language, which can be used to determine other internationalization-related characteristics.

#### Static Semantics

2/3
The library package Locales has the following declaration:
3/3
package Ada.Locales is
pragma Preelaborate(Locales);
pragma Remote_Types(Locales);
4/3
type Language_Code is array (1 .. 3) of Character range 'a' .. 'z';
type Country_Code is array (1 .. 2) of Character range 'A' .. 'Z';
5/3
Language_Unknown : constant Language_Code := "und";
Country_Unknown : constant Country_Code := "ZZ";
6/3
function Language return Language_Code;
function Country return Country_Code;
7/3
end Ada.Locales;
8/3
The active locale is the locale associated with the partition of the current task.
9/3
Language_Code is a lower-case string representation of an ISO 639-3 alpha-3 code that identifies a language.
10/3
Country_Code is an upper-case string representation of an ISO 3166-1 alpha-2 code that identifies a country.
11/3
Function Language returns the code of the language associated with the active locale. If the Language_Code associated with the active locale cannot be determined from the environment, then Language returns Language_Unknown.
12/3
Function Country returns the code of the country associated with the active locale. If the Country_Code associated with the active locale cannot be determined from the environment, then Country returns Country_Unknown.

Ada 2005 and 2012 Editions sponsored in part by Ada-Europe