How can I read native text of current locale?
Sometimes in application we want to show a text with description of current used locale.
For example, "English", "Russian", "Ukrainian", "Chinese" etc
For this task you can use verbose agename function from Windows API:
VaR
ID: langid;
Languagename: array [0 .. 255] of char;
Begin
{Read current system locale}
ID: = getsystemdefaultlangid;
{Convert an ID into text}
Verrentagename (ID, languagename, sizeof (languagename ));
Showmessage (cmdagename );
End;
Of course, you can expand this code and to translate a locale as parameter
For example, if ID is $419, you'll receive a "Russian ". for $ 0a-the "Spanish (traditional sort)", for $ 0c0c-the "French (Canadian)", for $407-"German (standard)" etc
Important
If ID is incorrect, you'll receive an "language neutral" as result
Text in result will be translated in the current language. I mean that text will be not in English if you have localized version of MS windows