Jump to content

ULSQueryLocaleItem: Difference between revisions

From EDM2
Created page with "==Description== Queries the value of the specified locale item. ==Arguments== ULSQueryLocaleItem( item [, locale][, codepage][, subchar ] ) Parameters: item The..."
 
Line 173: Line 173:


==Example==
==Example==
 
<PRE>
       Code
       Code


Line 195: Line 195:


         The default language for locale es_AR is "Spanish" ("Espa¤ol")
         The default language for locale es_AR is "Spanish" ("Espa¤ol")
</PRE>
[[Category:The OS/2 API Project]]

Revision as of 15:00, 16 June 2016

Description

Queries the value of the specified locale item.


Arguments

ULSQueryLocaleItem( item [, locale][, codepage][, subchar ] )


Parameters:

     item      The name or number of the locale item to be queried.  This must
               be one of the items listed below.  (The name, if used, is not
               case-sensitive.)
                 NAME              NUMBER   DESCRIPTION
                 sDateTime            1     Date and time format string
                 sShortDate           2     Short date format
                 sTimeFormat          3     Time format string
                 s1159                4     AM string
                 s2359                5     PM string
                 sAbbrevDayName7      6     Abbreviation of day 7 (Sun)
                 sAbbrevDayName1      7     Abbreviation of day 1 (Mon)
                 sAbbrevDayName2      8     Abbreviation of day 2 (Tue)
                 sAbbrevDayName3      9     Abbreviation of day 3 (Wed)
                 sAbbrevDayName4     10     Abbreviation of day 4 (Thu)
                 sAbbrevDayName5     11     Abbreviation of day 5 (Fri)
                 sAbbrevDayName6     12     Abbreviation of day 6 (Sat)
                 sDayName7           13     Name of day of week 7 (Sun)
                 sDayName1           14     Name of day of week 1 (Mon)
                 sDayName2           15     Name of day of week 2 (Tue)
                 sDayName3           16     Name of day of week 3 (Wed)
                 sDayName4           17     Name of day of week 4 (Thu)
                 sDayName5           18     Name of day of week 5 (Fri)
                 sDayName6           19     Name of day of week 6 (Sat)
                 sAbbrevMonthName1   20     Abbreviation of month 1
                 sAbbrevMonthName2   21     Abbreviation of month 2
                 sAbbrevMonthName3   22     Abbreviation of month 3
                 sAbbrevMonthName4   23     Abbreviation of month 4
                 sAbbrevMonthName5   24     Abbreviation of month 5
                 sAbbrevMonthName6   25     Abbreviation of month 6
                 sAbbrevMonthName7   26     Abbreviation of month 7
                 sAbbrevMonthName8   27     Abbreviation of month 8
                 sAbbrevMonthName9   28     Abbreviation of month 9
                 sAbbrevMonthName10  29     Abbreviation of month 10
                 sAbbrevMonthName11  30     Abbreviation of month 11
                 sAbbrevMonthName12  31     Abbreviation of month 12
                 sMonthName1         32     Name of month 1
                 sMonthName2         33     Name of month 2
                 sMonthName3         34     Name of month 3
                 sMonthName4         35     Name of month 4
                 sMonthName5         36     Name of month 5
                 sMonthName6         37     Name of month 6
                 sMonthName7         38     Name of month 7
                 sMonthName8         39     Name of month 8
                 sMonthName9         40     Name of month 9
                 sMonthName10        41     Name of month 10
                 sMonthName11        42     Name of month 11
                 sMonthName12        43     Name of month 12
                 sDecimal            44     Decimal point
                 sThousand           45     Triad separator
                 sYesString          46     Yes string
                 sNoString           47     No string
                 sCurrency           48     Currency symbol
                 sCodeSet            49     Locale codeset
                 xLocaleToken        50     IBM Locale Token
                 xWinLocale          51     Win32 Locale ID
                 iLocaleResnum       52     Resource number for description
                 sNativeDigits       53     String of native digits
                 iMaxItem            54     Maximum item number
                 sTimeMark           55     Time mark (am/pm) format
                 sEra                56     Era definition
                 sAltShortDate       57     Alternate short date format string
                 sAltDateTime        58     Alternate date and time format
                 sAltTimeFormat      59     Alternate time format
                 sAltDigits          60     XPG4 alternate digits
                 sYesExpr            61     XPG4 Yes expression
                 sNoExpr             62     XPG4 No expression
                 sDate               63     Short date separator
                 sTime               64     Time separator
                 sList               65     List separator
                 sMonDecimalSep      66     Monetary currency separator
                 sMonThousandSep     67     Monetary triad separator
                 sGrouping           68     Grouping of digits
                 sMonGrouping        69     Monetary groupings
                 iMeasure            70     Measurement (Metric, British)
                 iPaper              71     Normal paper size
                 iDigits             72     Digits to right of decimal
                 iTime               73     Clock format
                 iDate               74     Format of short date
                 iCurrency           75     Format of currency
                 iCurrDigits         76     Digits to right for currency
                 iLzero              77     Leading zero used
                 iNegNumber          78     Format of negative number
                 iLDate              79     Format of long date
                 iCalendarType       80     Type of default calandar
                 iFirstDayOfWeek     81     First day of week (0=Mon)
                 iFirstWeekOfYear    82     First week of year
                 iNegCurr            83     Format of negative currency
                 iTLzero             84     Leading zero on time
                 iTimePrefix         85     AM/PM preceeds time
                 iOptionalCalendar   86     Alternate calandar type
                 sIntlSymbol         87     International currency symbol
                 sAbbrevLangName     88     Windows language abbreviation
                 sCollate            89     Collation table
                 iUpperType          90     Upper case algorithm
                 iUpperMissing       91     Action for missing upper case
                 sPositiveSign       92     Positive sign
                 sNegativeSign       93     Negative sign
                 sLeftNegative       94     Left paren for negative
                 sRightNegative      95     Right paren for negative
                 sLongDate           96     Long date formatting string
                 sAltLongDate        97     Alternate long date format string
                 sMonthName13        98     Name of month 13
                 sAbbrevMonthName13  99     Abbreviation of month 13
                 sName              100     OS/2 locale name
                 sLanguageID        101     Abbreviation for language (ISO)
                 sCountryID         102     Abbreviation for country (ISO)
                 sEngLanguage       103     English name of Language
                 sLanguage          104     Native name of language
                 sEngCountry        105     English name of country
                 sCountry           106     Localized country name
                 sNativeCtryName    107     Name of country in native language
                 iCountry           108     Country code
                 sISOCodepage       109     ISO codepage name
                 iAnsiCodepage      110     Windows codepage
                 iCodepage          111     OS/2 primary codepage
                 iAltCodepage       112     OS/2 alternate codepage
                 iMacCodepage       113     Mac codepage
                 iEbcdicCodepage    114     Ebcdic codepage
                 sOtherCodepages    115     Other ASCII codepages
                 sSetCodepage       116     Codpage to set on activation
                 sKeyboard          117     Primary keyboard name
                 sAltKeyboard       118     Alternate keyboard name
                 sSetKeyboard       119     Keyboard to set on activation
                 sDebit             120     Debit string
                 sCredit            121     Credit string
                 sLatin1Locale      122     Locale for Latin 1 names
                 wTimeFormat        123     Win32 Time format
                 wShortDate         124     Win32 Date format
                 wLongDate          125     Win32 Long date format
                 jISO3CountryName   126     Java abbrev for country (ISO-3)
                 jPercentPattern    127     Java percent pattern
                 jPercentSign       128     Java percent symbol
                 jExponent          129     Java exponential symbol
                 jFullTimeFormat    130     Java full time format
                 jLongTimeFormat    131     Java long time format
                 jShortTimeFormat   132     Java short time format
                 jFullDateFormat    133     Java full date format
                 jMediumDateFormat  134     Java medium date format
                 jDateTimePattern   135     Java date time format pattern
                 jEraStrings        136     Java era strings
     locale    The name of the locale whose values are being queried.  Locale
               names are usually of the form "xx_YY", where "xx" is a language
               and YY is a country (e.g. "en_US", "zh_TW", "it_IT", etc.)  The
               default is to use the current locale as defined by the LANG and
               LC_* environment variables.
     codepage  The codepage into which the returned value will be converted.
               (Locale item values are stored internally as Unicode UCS-2
               text.  To return the value in UCS-2, specify codepage 1200.)
     subchar   The substitution character for the target codepage.  This is a
               two-letter hexadecimal value between 00 and FF which represents
               the character in the target codepage which will be used to
               represent substituted (i.e. unsupported) characters.  The
               default value depends on the codepage; for most single-byte
               codepages it is 0x7F (?).
               NOTE: Not all codepages appear to honour this setting!

Returns

The value of the specified locale item, as converted into the requested codepage.

Example

      Code

        /* Query the name of the language for locale 'es_AR' (Argentina)
         * in both English and the localized language itself.
         */
        englang = ULSQueryLocaleItem('sEngLanguage', 'es_AR', 850 )
        IF ULSERR \= '0' THEN DO
            SAY ULSERR
            RETURN
        END
        natlang = ULSQueryLocaleItem('sLanguage', 'es_AR', 850 )
        IF ULSERR \= '0' THEN DO
            SAY ULSERR
            RETURN
        END

        SAY 'The default language for locale es_AR is "'englang'" ("'natlang'")'

      Output

        The default language for locale es_AR is "Spanish" ("Espa¤ol")