We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Currency Symbol

S_Warrior
S_Warrior asked
on
Medium Priority
491 Views
Last Modified: 2010-04-05
Hi Exports,

I have a small question, How do I get all the Regional Options language list and there currency symbols and values?
Comment
Watch Question

Top Expert 2004

Commented:
usual there is a bunch of variables in the sysutils-unit,
which are initilazed during app-start

see chapter
Currency and date/time formatting variables
in the delphi-help

meikl ;-)

Author

Commented:
no, I need to get the complete list of the languages in the regional settings + currency symbols of every language.
Top Expert 2004

Commented:
?? in this list are all countries of the world, except maybe some minor countries

Author

Commented:
Well I need this list + I want every counter currency symbol.
CERTIFIED EXPERT
Commented:
Here's a demo:

pas:
===

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, DB, Grids, DBGrids, DBClient;

type
  TForm1 = class(TForm)
    rgOption: TRadioGroup;
    Button2: TButton;
    ClientDataSet1: TClientDataSet;
    ClientDataSet1LCID: TIntegerField;
    ClientDataSet1Language: TStringField;
    ClientDataSet1Country: TStringField;
    ClientDataSet1CurrencySymbol: TStringField;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    Label1: TLabel;
    ClientDataSet1currency: TStringField;
    procedure Button2Click(Sender: TObject);
    procedure DBGrid1TitleClick(Column: TColumn);
    procedure FormCreate(Sender: TObject);
  end;

var
  Form1: TForm1;
  LocaleIDs: TStringList;

implementation

{$R *.dfm}

function EnumLCIDs(LCIDStr: pchar): boolean; stdcall;
begin
  LocaleIDs.Add(StrPas(LCIDStr));
  result:= true;
end;

procedure TForm1.Button2Click(Sender: TObject);
var i: integer;
    data: array[0..63] of char;
begin
  LocaleIDs.Clear;
  case rgOption.ItemIndex of
    0: EnumSystemLocales(@EnumLCIDs, LCID_INSTALLED);
    1: EnumSystemLocales(@EnumLCIDs, LCID_SUPPORTED);
  end;

  ClientDataSet1.EmptyDataSet;
  for i:= 0 to LocaleIDs.Count-1 do
  begin
    ClientDataSet1.Append;
    ClientDataSet1LCID.Value:= StrToInt('$'+LocaleIDs[i]);

    GetLocaleInfo(StrToInt('$'+LocaleIDs[i]), LOCALE_SCOUNTRY, data, SizeOf(Data));
    ClientDataSet1Country.Value:= StrPas(data);

    GetLocaleInfo(StrToInt('$'+LocaleIDs[i]), LOCALE_SLANGUAGE, data, SizeOf(Data));
    ClientDataSet1Language.Value:= StrPas(data);

    GetLocaleInfo(StrToInt('$'+LocaleIDs[i]), LOCALE_SCURRENCY, data, SizeOf(Data));
    ClientDataSet1Currency.Value:= StrPas(data);

    GetLocaleInfo(StrToInt('$'+LocaleIDs[i]), LOCALE_SINTLSYMBOL, data, SizeOf(Data));
    ClientDataSet1CurrencySymbol.Value:= StrPas(data);

    ClientDataSet1.Post;
  end;

end;

procedure TForm1.DBGrid1TitleClick(Column: TColumn);
begin
  ClientDataSet1.IndexFieldNames:= Column.FieldName;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ClientDataSet1.CreateDataSet;
end;

initialization
  LocaleIDs:= TStringList.Create;

finalization
  LocaleIDs.Free;

end.


DFM
===

object Form1: TForm1
  Left = 192
  Top = 114
  Width = 656
  Height = 442
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  DesignSize = (
    648
    408)
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 328
    Top = 16
    Width = 177
    Height = 13
    Caption = 'Click on a heading to sort by that field'
  end
  object rgOption: TRadioGroup
    Left = 112
    Top = 8
    Width = 161
    Height = 35
    Caption = 'LCID option'
    Columns = 2
    ItemIndex = 0
    Items.Strings = (
      'Installed'
      'Supported')
    TabOrder = 0
  end
  object Button2: TButton
    Left = 16
    Top = 8
    Width = 75
    Height = 25
    Caption = 'List/Refresh'
    TabOrder = 1
    OnClick = Button2Click
  end
  object DBGrid1: TDBGrid
    Left = 16
    Top = 48
    Width = 614
    Height = 347
    Anchors = [akLeft, akTop, akRight, akBottom]
    DataSource = DataSource1
    TabOrder = 2
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'MS Sans Serif'
    TitleFont.Style = []
    OnTitleClick = DBGrid1TitleClick
  end
  object ClientDataSet1: TClientDataSet
    Aggregates = <>
    Params = <>
    Left = 240
    Top = 8
    object ClientDataSet1LCID: TIntegerField
      DisplayWidth = 12
      FieldName = 'LCID'
    end
    object ClientDataSet1Country: TStringField
      DisplayWidth = 31
      FieldName = 'Country'
      Size = 50
    end
    object ClientDataSet1Language: TStringField
      DisplayWidth = 25
      FieldName = 'Language'
      Size = 50
    end
    object ClientDataSet1currency: TStringField
      DisplayLabel = 'Currency'
      FieldName = 'currency'
      Size = 10
    end
    object ClientDataSet1CurrencySymbol: TStringField
      DisplayWidth = 15
      FieldName = 'CurrencySymbol'
      Size = 3
    end
  end
  object DataSource1: TDataSource
    DataSet = ClientDataSet1
    Left = 272
    Top = 8
  end
end

Regards
Pierre

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.