set locale
During the installation process, you have been asked to specify a language and a country in order to set the locale settings applicable for B4P.
The locale settings rule data formats such as numbers, dates and times, and also chooses the right language for weekdays and months. This function
is available to change the locale setting to a different locale.
You can either specify a country, a language or a locale keyword (like en_US). Specifying a country is fine if only one major language is spoken
(e.g. English for Great Britain), and specifying a language is fine if the language is spoken in one country or a few (e.g. German). For German, Germany
is assumed. For Spanish, Spain is assumed. In order to specify the locale properly (e.g. Canadian French fr_CA, Spanish in Mexico es_MX), using
locale codes is recommended.
Indirect parameter passing is disabled.
1
No. | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 input |
string | Locale All values (Locale, Language, Country) are supported. First match is assumed if specifying language or country.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Opt. 2 input |
string | Locale table file name In case you have maintained your own locale file (e.g. to support additional countries or specifi configurations), then specify the CSV file name with your locale data. The CSV file must contain the same column header names as the original "List of Locales.csv"). |
orig locale[] = local settings[locale];
echo("Keep the original locale in order to restore orig. settings later on: ", orig locale[] );
date[] = date( "2020-01-14" );
num[] = 12345678.90;
for all( { en_IN, es_US, de_AT, it_IT, Switzerland }, loc[], i[] )
{
echo(loc[],":");
set locale( loc[] );
echo( str( date[], " Tttt, DD.Mmmm.YYYY", local ) );
echo( str( num[], " #,###.##", local ) );
if (i[]==0) list system variables( "local settings" ); // Do this for 1 example
}
set locale( orig locale[] );
Keep the original locale in order to restore orig. settings later on: de_CH
en_IN:
Tuesday, 14.January.2020
1,23,45,678.9
Variable List Level = 0 Regional Level = 0 System variables
-------------------------------------------------------------------------------
local settings [Void] (void,read only)
country name India (string,read only)
currency symbol ₹ (string,limited access)
date format D/M/YYYY (string,limited access)
date format short DMY (string,limited access)
date separator / (string,limited access)
decimal separator . (string,limited access)
language English (string,read only)
list separator , (string,limited access)
locale en_IN (string,read only)
thousand separator , (string,limited access)
time format HH:II:SS (string,limited access)
time separator : (string,limited access)
es_US:
Martes, 14.Enero.2020
12,345,678.9
de_AT:
Dienstag, 14.Jänner.2020
12 345 678,9
it_IT:
Martedì, 14.Gennaio.2020
12.345.678,9
Switzerland:
Dienstag, 14.Januar.2020
12'345'678.9