Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 6/24/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

NLSGetLocaleInfo

NLS Function: Returns information about the current locale. This routine is only available for Windows.

Module

USE IFNLS

result = NLSGetLocaleInfo (type,outstr)

type

(Input) INTEGER(4). Is the NLS parameter requested. A list of parameter names is provided in NLS LocaleInfo Parameters.

outstr

(Output) Character*(*). Is the parameter setting for the current locale. All parameter settings placed in outstr are character strings, even numbers. If a parameter setting is numeric, the ASCII representation of the number is used.

If the requested parameter is a date or time string, an explanation of how to interpret the format in outstr is provided in NLS Date and Time Format.

Results

The result type is INTEGER(4). The result is the number of characters written to outstr if successful, or if outstr has 0 length, the number of characters required to hold the requested information.

Otherwise, the result is one of the following error codes (defined in IFNLS.F90):

  • NLS$ErrorInvalidInput - type has an illegal value.

  • NLS$ErrorInsufficientBuffer - The outstr buffer was too small, but was not 0 (so that the needed size would be returned).

The NLS$LI parameters are used for the argument type and select the locale information returned by NLSGetLocaleInfo in outstr. You can perform an inclusive OR with NLS$NoUserOverride and any NLS$LI parameter. This causes NLSGetLocaleInfo to bypass any user overrides and always return the system default value.

The following table lists and describes the NLS$LI parameters in alphabetical order.

NLS LocaleInfo Parameters

Parameter

Description

NLS$LI_ICALENDARTYPE

Specifies which type of calendar is currently being used:

1 - Gregorian (as in United States)

2 - Gregorian (English strings always)

3 - Era: Year of the Emperor (Japan)

4 - Era: Year of the Republic of China

5 - Tangun Era (Korea)

NLS$LI_ICENTURY

Specifies whether to use full 4-digit century for the short date only:

0 - Two-digit year

1 - Full century

NLS$LI_ICOUNTRY

Is the country code, based on international phone codes, also referred to as IBM country codes.

NLS$LI_ICURRDIGITS

Is the number of decimal digits for the local monetary format.

NLS$LI_ICURRENCY

Determines how positive currency is represented:

0 - Puts currency symbol in front with no separation: $1.1

1 - Puts currency symbol in back with no separation: 1.1$

2 - Puts currency symbol in front with single space after: $ 1.1

3 - Puts currency symbol in back with single space before: 1.1 $

NLS$LI_IDATE

Short Date format ordering:

0 - Month-Day-Year

1 - Day-Month-Year

2 - Year-Month-Day

NLS$LI_IDAYLZERO

Specifies whether to use leading zeros in day fields for the short date only:

0 - Use no leading zeros

1 - Use leading zeros

NLS$LI_IDEFAULTANSICODEPAGE

Is the ANSI code page associated with this locale.

NLS$LI_IDEFAULTCOUNTRY

Is the country code for the principal country in this locale. This is provided so that partially specified locales can be completed with default values.

NLS$LI_IDEFAULTLANGUAGE

Is the language ID for the principal language spoken in this locale. This is provided so that partially specified locales can be completed with default values.

NLS$LI_IDEFAULTOEMCODEPAGE

Is the OEM code page associated with the locale.

NLS$LI_IDIGITS

Is the number of decimal digits.

NLS$LI_IFIRSTDAYOFWEEK

Specifies which day is considered first in a week:

0 - SDAYNAME1

1 - SDAYNAME2

2 - SDAYNAME3

3 - SDAYNAME4

4 - SDAYNAME5

5 - SDAYNAME6

6 - SDAYNAME7

NLS$LI_IFIRSTWEEKOFYEAR

Specifies which week of the year is considered first:

0 - Week containing 1/1

1 - First full week following 1/1

2 - First week containing at least 4 days

NLS$LI_IINTLCURRDIGITS

Is the number of decimal digits for the international monetary format.

NLS$LI_ILANGUAGE

Is an ID indicating the language.

NLS$LI_ILDATE

Long Date format ordering:

0 - Month-Day-Year

1 - Day-Month-Year

2 - Year-Month-Day

NLS$LI_ILZERO

Determines whether to use leading zeros in decimal fields:

0 - Use no leading zeros

1 - Use leading zeros

NLS$LI_IMEASURE

This value is 0 if the metric system (S.I.) is used and 1 for the U.S. system of measurements.

NLS$LI_IMONLZERO

Specifies whether to use leading zeros in month fields for the short date only:

0 - Use no leading zeros

1 - Use leading zeros

NLS$LI_INEGCURR

Determines how negative currency is represented:

0 ($1.1)

1 -$1.1

2 $-1.1

3 $1.1-

4 (1.1$)

5 -1.1$

6 1.1-$

7 1.1$-

8 -1.1 $ (space before $)

9 -$ 1.1 (space after $)

10 1.1 $- (space before $)

11 $ 1.1- (space after $)

12 $ -1.1 (space after $)

13 1.1- $ (space before $)

14 ($ 1.1) (space after $)

15 (1.1 $) (space before $)

NLS$LI_INEGNUMBER

Determines how negative numbers are represented:

0 - Puts negative numbers in parentheses: (1.1)

1 - Puts a minus sign in front: -1.1

2 - Puts a minus sign followed by a space in front: - 1.1

3 - Puts a minus sign after: 1.1-

4 - Puts a space then a minus sign after: 1.1 -

NLS$LI_INEGSEPBYSPACE

1 if the monetary symbol is separated by a space from a negative amount; otherwise, 0.

NLS$LI_INEGSIGNPOSN

Determines the formatting index for negative values. Same values as for NLS$LI_IPOSSIGNPOSN.

NLS$LI_INEGSYMPRECEDES

1 if the monetary symbol precedes, 0 if it follows a negative amount.

NLS$LI_IOPTIONALCALENDAR

Specifies which additional calendar types are valid and available for this locale. This can be a null separated list of all valid optional calendars:

0 - No additional types valid

1 - Gregorian (localized)

2 - Gregorian (English strings always)

3 - Era: Year of the Emperor (Japan)

4 - Era: Year of the Republic of China

5 - Tangun Era (Korea)

NLS$LI_IPOSSEPBYSPACE

1 if the monetary symbol is separated by a space from a positive amount; otherwise, 0.

NLS$LI_IPOSSIGNPOSN

Determines the formatting index for positive values:

0 - Parenthesis surround the amount and the monetary symbol

1 - The sign string precedes the amount and the monetary symbol

2 - The sign string follows the amount and the monetary symbol

3 - The sign string immediately precedes the monetary symbol

4 - The sign string immediately follows the monetary symbol

NLS$LI_IPOSSYMPRECEDES

1 if the monetary symbol precedes, 0 if it follows a positive amount.

NLS$LI_ITIME

Time format:

0 - Use 12-hour format

1 - Use 24-hour format

NLS$LI_ITLZERO

Determines whether to use leading zeros in time fields:

0 - Use no leading zeros

1 - Use leading zeros for hours

NLS$LI_S1159

Is the string for the AM designator.

NLS$LI_S2359

Is the string for the PM designator.

NLS$LI_SABBREVCTRYNAME

Is the abbreviated name of the country as per ISO Standard 3166.

NLS$LI_SABBREVDAYNAME1 -
NLS$LI_SABBREVDAYNAME7

Is the native abbreviated name for each day of the week. 1 = Mon, 2 = Tue, etc.

NLS$LI_SABBREVLANGNAME

Is the abbreviated name of the language, created by taking the 2-letter language abbreviation as found in ISO Standard 639 and adding a third letter as appropriate to indicate the sublanguage.

NLS$LI_SABBREVMONTHNAME1 -
NLS$LI_SABBREVMONTHNAME13

Is the native abbreviated name for each month. 1 = Jan, 2 = Feb, etc. 13 = the 13th month, if it exists in the locale.

NLS$LI_SCOUNTRY

Is the full localized name of the country.

NLS$LI_SCURRENCY

Is the string used as the local monetary symbol. Cannot be set to digits 0-9.

NLS$LI_SDATE

Is the character(s) for the date separator. Cannot be set to digits 0-9.

NLS$LI_SDAYNAME1 -
NLS$LI_SDAYNAME7

Is the native name for each day of the week. 1 = Monday, 2 = Tuesday, etc.

NLS$LI_SDECIMAL

Is the character(s) used as decimal separator. This is restricted such that it cannot be set to digits 0 - 9.

NLS$LI_SENGCOUNTRY

Is the full English name of the country. This will always be restricted to characters that map into the ASCII 127 character subset.

NLS$LI_SENGLANGUAGE

Is the full English name of the language from the ISO Standard 639. This will always be restricted to characters that map into the ASCII 127 character subset.

NLS$LI_SGROUPING

Are the sizes for each group of digits to the left of the decimal. An explicit size is needed for each group; sizes are separated by semicolons. If the last value is 0 the preceding value is repeated. To group thousands, specify "3;0".

NLS$LI_SINTLSYMBOL

Three characters of the International monetary symbol specified in ISO 4217 "Codes for the Representation of Currencies and Funds", followed by the character separating this string from the amount.

NLS$LI_SLANGUAGE

Is the full localized name of the language.

NLS$LI_SLIST

Is the character(s) used to separate list items, for example, comma in many locales.

NLS$LI_SLONGDATE

Long Date formatting string for this locale. The string returned may contain a string within single quotes (' '). Any characters within single quotes should be left as is. The d, M and y should have the day, month, and year substituted, respectively.

NLS$LI_SMONDECIMALSEP

Is the character(s) used as monetary decimal separator. This is restricted such that it cannot be set to digits 0-9.

NLS$LI_SMONGROUPING

Are the sizes for each group of monetary digits to the left of the decimal. If the last value is 0, the preceding value is repeated. To group thousands, specify "3;0".

NLS$LI_SMONTHNAME1 -
NLS$LI_SMONTHNAME13

Is the native name for each month. 1 = January, 2 = February, etc. 13 = the 13th month, if it exists in the locale.

NLS$LI_SMONTHOUSANDSEP

Is the character(s) used as monetary separator between groups of digits left of the decimal. Cannot be set to digits 0-9.

NLS$LI_SNATIVECTRYNAME

Is the native name of the country.

NLS$LI_SNATIVEDIGITS

The ten characters that are the native equivalent to the ASCII 0-9.

NLS$LI_SNATIVELANGNAME

Is the native name of the language.

NLS$LI_SNEGATIVESIGN

String value for the negative sign. Cannot be set to digits 0-9.

NLS$LI_SPOSITIVESIGN

String value for the positive sign. Cannot be set to digits 0-9.

NLS$LI_SSHORTDATE

Short Date formatting string for this locale. The d, M and y should have the day, month, and year substituted, respectively. See NLS Date and Time Format for explanations of the valid strings.

NLS$LI_STHOUSAND

Is the character(s) used as separator between groups of digits left of the decimal. This is restricted such that it cannot be set to digits 0 - 9.

NLS$LI_STIME

Character(s) for the time separator. Cannot be set to digits 0-9.

NLS$LI_STIMEFORMAT

Time formatting string. See NLS Date and Time Format for explanations of the valid strings.

When NLSGetLocaleInfo ( type, outstr) returns information about the date and time formats of the current locale, the value returned in outstr can be interpreted according to the following tables.

Any text returned within a date and time string that is enclosed within single quotes should be left in the string in its exact form; that is, do not change the text or the location within the string.

Day

The day can be displayed in one of four formats using the letter "d". The following table shows the four variations:

d

Day of the month as digits without leading zeros for single-digit days

dd

Day of the month as digits with leading zeros for single-digit days

ddd

Day of the week as a three-letter abbreviation (SABBREVDAYNAME)

dddd

Day of the week as its full name (SDAYNAME)

Month

The month can be displayed in one of four formats using the letter "M". The uppercase "M" distinguishes months from minutes. The following table shows the four variations:

M

Month as digits without leading zeros for single-digit months

MM

Month as digits with leading zeros for single-digit months

MMM

Month as a three-letter abbreviation (SABBREVMONTHNAME)

MMMM

Month as its full name (SMONTHNAME)

Year

The year can be displayed in one of three formats using the letter "y". The following table shows the three variations:

y

Year represented by only the last digit

yy

Year represented by only the last two digits

yyyy

Year represented by the full 4 digits

Period/Era

The period/era string is displayed in a single format using the letters "gg".

gg

Period/Era string

Time

The time can be displayed in one of many formats using the letter "h" or "H" to denote hours, the letter "m" to denote minutes, the letter "s" to denote seconds and the letter "t" to denote the time marker.

The following table shows the numerous variations of the time format. Lowercase "h" denotes the 12 hour clock and uppercase "H" denotes the 24 hour clock. The lowercase "m" distinguishes minutes from months.

h

Hours without leading zeros for single-digit hours (12 hour clock)

hh

Hours with leading zeros for single-digit hours (12 hour clock)

H

Hours without leading zeros for single-digit hours (24 hour clock)

HH

Hours with leading zeros for single-digit hours (24 hour clock)

m

Minutes without leading zeros for single-digit minutes

mm

Minutes with leading zeros for single-digit minutes

s

Seconds without leading zeros for single-digit seconds

ss

Seconds with leading zeros for single-digit seconds

t

One-character time marker string

tt

Multicharacter time marker string

Example

 USE IFNLS
 INTEGER(4) strlen
 CHARACTER(40) str
 strlen = NLSGetLocaleInfo(NLS$LI_SDAYNAME1, str)
 print *, str    ! prints Monday if language is English
 strlen = NLSGetLocaleInfo(NLS$LI_SDAYNAME2, str)
 print *, str    ! prints Tuesday if language is English