Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define Location and Display language from Windows Control panel

Tags:

locale

delphi

enter image description here

Delphi xe.

For Tab Administrative - Unicode lang
use GetSystemDefaultLangID

For Tab Formats -
use GetUserDefaultLangID

But what do I use for For Tab Location?

For Tab "Keyboard and Language"
for Vista and above: Getlocaleinfo with key LOCALE_CUSTOM_UI_DEFAULT

Function GetLocaleInformation(flag: integer): string;
var
  pclca: array[0..20] of char;
begin
  if (GetLocaleInfo(
      //locale_system_default - Always identical values returns
      LOCALE_CUSTOM_UI_DEFAULT // work only Vista-Win7, not Xp **
      ,flag,pclca,19) <= 0 ) then begin
    pclca[0] := #0;
  end;
  Result := pclca;
end;
  1. How do I define Location in Xp+Win7 and Display Language in Xp?
  2. Can be a universal key for definition "Display Language" both for Xp and for Win7
  3. How to receive the list of the established languages of the interface?
like image 593
Gu. Avatar asked Dec 17 '11 09:12

Gu.


1 Answers

1.1 - How to get selected geographical location (geographic ID) ?

Use the GetUserGeoID function which returns the geographical location currently selected by user.


1.2 - How to get selected display language for Multilingual User Interface (MUI) in Windows XP ?

Use the GetUserDefaultUILanguage function which returns the language identifier currently selected by user.


2 - Is there an universal way how to get the selected display language supported since Windows XP till Windows 7 ?

Yes, it is. It's just the previously mentioned GetUserDefaultUILanguage function. There's a remark:

If the user UI language is part of a Language Interface Pack (LIP) and corresponds to a supplemental locale, this function returns LOCALE_CUSTOM_UI_DEFAULT.

It is supported since Windows 2000 and it should return selected display language even for Windows Vista above (LOCALE_CUSTOM_UI_DEFAULT).


3 - How to get the list of available user interface languages ?

Use the EnumUILanguages function. In Windows XP, it passes the language identifiers to the EnumUILanguagesProc callback function. Since Windows Vista you can even specify additional flags which supplies to pass the language names to that callback function or you can specify the filtering for licensed languages or for the languages allowed by the group policy.

like image 146
TLama Avatar answered Oct 21 '22 14:10

TLama