Rationale for Ada 2012
When writing portable software it is often necessary
to know the locality in which the software is to be run. Two key items
are the country and the language (human language that is, not programming
To enable this to be
done, Ada 2012 includes the following package
type Language_Code is array (1 .. 3) of Character range 'a' .. 'z';
type Country_Code is array (1 .. 2) of Character range 'A' .. 'Z';
Language_Unknown: constant Language_Code := "und";
Country_Unknown: constant Country_Code := "ZZ";
function Language return Language_Code;
function Country return Country-Code;
The various country codes and language codes are
defined in ISO/IEC 3166-1:2006 and ISO/IEC 639-3:2007 respectively.
Knowledge of the locale is important for writing
programs where the convention for certain information varies. Thus in
giving a date we might want to add the name of the day of the week and
clearly in order to do this we need to know what language to use. An
earlier (really grotesque) attempt at providing this information introduced
a host of packages addressing many issues. However, it was decided that
for simplicity and indeed reliability all that is really needed is to
know the language to use and the country.
Canada is interesting in that it has just one country
code ("CA") but two language codes
("eng" and "fra").
In Quebec, a decimal value for a million dollars and one cent is written
as $1.000.000,01 whereas in English language parts it is written as $1,000,000.01
with the comma and stop interchanged.
Sometimes, several locales might be available on
a target. Some environments define a system locale and a locale for the
current user. In the case of an Ada program the active locale is the
one associated with the partition of the current task.
Finally, note that subsequent to ISO standardization,
some serious difficulty was found in the practical use of the types Language_Code
and Country_Code. Accordingly, they have been changed as described in
of the Epilogue.
© 2011, 2012, 2013 John Barnes Informatics.
Sponsored in part by: