Solved

Get System Language

Posted on 2003-11-06
4
408 Views
Last Modified: 2010-04-05
How can i get the real windows language
That is windows can be english but regional settings is set to turkish.
I want English. (Language of start menu's language), not want regional settings language

Thanx
0
Comment
Question by:mece
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 9695304
procedure TForm1.Button1Click(Sender: TObject);
var
  Ident: Integer;
  MyLang: PChar;
const
  Size: Integer = 250;  
begin
  GetMem(MyLang, Size);
  Ident:=GetSystemDefaultLangID;
  VerLanguageName(Ident, MyLang, Size);
  Label1.Caption:='System language: '+StrPas(MyLang);
  Ident:=GetUserDefaultLangID;
  VerLanguageName(Ident, MyLang, Size);
  Label2.Caption:='User language: '+StrPas(MyLang);
  FreeMem(MyLang);
end;

F68 ;-)
0
 

Author Comment

by:mece
ID: 9699497
thanx for answer but that is not what i want
i know this code and this gives the regional settings language
for example my windows is english and i live in turkey, my regional settings set to turkish
above code gives turkish as the asnwer but i want english (windows language)
0
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 125 total points
ID: 9723566
Well finally i have understood what you mean...

As i know there a file in System Directory that has this information: Winver.exe (from W95 to WXP).

The way is to read the versioninfo of this file and check for the LanguageID of the file. Look at the following example:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
   function  GetWinVerLanguage:string;
   var
   Size, Size2 : DWord;
   Pt, Pt2     : Pointer;
   WinFile      : string;
   Syspath,Language: Array[0..255] of char;
   i: Cardinal;
   begin
     getsystemdirectory(SysPath,255);
     WinFile := STrPas(SysPath)+'\winver.exe';
     Result:='No language info available';
     Size := GetFileVersionInfoSize(PChar (winfile), Size2);
     if Size > 0 then
     begin
       GetMem (Pt, Size);
       GetFileVersionInfo (PChar (winfile), 0, Size, Pt);
       VerQueryValue( Pt, '\VarFileInfo\Translation',Pt2, Size2);
       i :=  DWord(Pt2^);
       VerLanguageName(i,Language,255);
       result := STrPas(Language);
     end else
       raise exception.Create ( 'Sorry there are not Language VersionInfo available'+
                                'in Windows.');
   end;
begin
    SHowMessage('Windows language: '+GetWinVerLanguage);
end;
end.

Hope this help.

F68 ;-)
0
 

Author Comment

by:mece
ID: 9731224
thanx dude,
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question