Author Topic: WPS Locale Object Questions  (Read 3872 times)

Doug Clark

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +7/-1
    • View Profile
WPS Locale Object Questions
« on: August 21, 2020, 11:47:55 pm »
In the System Setup folder there is a WPS object called Locale.

That object appears to have locale settings that are not obtainable from the OS/2 Control Program DosQueryCtryInfo() function.  Furthermore for the items in the WPS Locale object that DO appear in DosQueryCtyInfo() the settings shown in the WPS Locale object don't match the values returned by DosQueryCtyInfo().    For example the date separator character - see attachments.

So my questions are:

1) What locale does the WPS Locale object change or show?
2) How do I access those settings from a C language program?
3) Is there some object that reconciles what is returned by DosQueryCtyInfo() and the WPS Locale Object

Thanks



« Last Edit: August 21, 2020, 11:50:01 pm by Doug Clark »

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: WPS Locale Object Questions
« Reply #1 on: August 22, 2020, 02:40:17 am »
In the System Setup folder there is a WPS object called Locale.
...
So my questions are:

1) What locale does the WPS Locale object change or show?
Here's a partial list. Note the Euro versions are missing. http://www.borgendale.com/locname.htm
You can create locales in the locale object and drag'n'drop onto an object. I used that method with the screen saver when trying to fix the Cairo Clock, Cairo only accepts UTF8 (Code page IBM-1208).
Try it, create a new locale, lets say es_ES by clicking Locale-->Open As-->New Locale and enter es_ES, which will open the properties for es_ES in case you want to change anything. The right click on the desktop, open the properties, go to page 3 of the screensaver, choose the Cairo Clock, and drag,n,drop the new locale on the properties page. Now the clock is in Spanish, including the configuration, help and such. For Euro support, it would be es_ES_euro.
This doesn't work very well for locales like Cyrillic ones or DBCS ones unless the system is set up correctly.
Quote
2) How do I access those settings from a C language program?
Start here, http://www.altsan.org/os2/toolkits/uls/uniapi.htm
Quote
3) Is there some object that reconciles what is returned by DosQueryCtyInfo() and the WPS Locale Object
I don't think so but don't really know. A well written program can read the LANG environment variable or query it.
Quote
Thanks
« Last Edit: August 22, 2020, 02:47:43 am by Dave Yeo »

Alex Taylor

  • Sr. Member
  • ****
  • Posts: 387
  • Karma: +5/-0
    • View Profile
Re: WPS Locale Object Questions
« Reply #2 on: August 22, 2020, 06:48:49 am »
There are basically three sets of localization settings in OS/2:
  • The COUNTRY settings defined in CONFIG.SYS and COUNTRY.SYS.
  • The PM_National settings used globally by Presentation Manager and various old PM applications.
  • Universal Language Support (ULS) locales.

What you see in the Locale (or Country) Palette are ULS locale objects. These locales are available for applications to use if they are written to take advantage of them. (In other words, applications that use the Universal Language Support API or another API that uses ULS in turn.)

Locale objects were designed to make it possible for individual applications to use standardized language and localization settings for arbitrary locales, and not be restricted by the old global PM_National settings in OS2.INI.  Much of Presentation Manager itself, however, is not ULS enabled and thus only uses the PM_National settings; ditto many old PM applications.  (You can sync PM_National with a given locale object by using the 'mark as default' option in the Locale Palette, thereby causing these ULS-unaware applications to use the settings for that locale.)

ULS-aware applications have the option of using 'system' locale objects, which are defined (hard-coded) by OS/2; or 'user locales', which are the ones defined in the Locale Palette. IIRC, when you create a locale object instance for a given locale name, you will be returned the user locale by that name if one is defined, or the system locale by that name otherwise (assuming it exists). Hence, user locales can be used to override system locales, although I believe there are some limitations on this (I don't recall what).

ULS and PM_National both apply at the application level (in the latter case, Presentation Manager itself is such an application). Conversely, what you get from DosQueryCtryInfo is the COUNTRY locale information which runs at the base OS level.  It's basically always accessible to any type of application, but is much more limited in scope.

In short: DosQueryCtryInfo returns the lowest-level (and simplest) locale information. Applications can choose to use higher-level locale data (PM_National or ULS locale objects) depending on how much trouble they want to go to.  ULS objects are the most flexible but also the most work to deal with.

Doug Clark

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +7/-1
    • View Profile
Re: WPS Locale Object Questions
« Reply #3 on: August 22, 2020, 07:37:23 am »
Thank you Dave and Alex for your responses.

It looks like you (Alex) have a page up that answers the next questions I was going to ask - mainly related to documentation -  which Dave linked to.

And I noticed that Alex also has some good information on EDM/2 about code pages and limitations with certain PM controls using non-latin code pages

Thanks again.