Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Get System Language

Posted on 2003-11-06
4
Medium Priority
?
413 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 23

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 23

Accepted Solution

by:
Ferruccio Accalai earned 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

610 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