Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

multi language for my program

I make program and I want to let the user to select his language(english,arabic)...
I know some of programs store the objects caption in external ini file....but how ?
0
sal1150
Asked:
sal1150
  • 4
  • 2
  • 2
  • +7
4 Solutions
 
geobulCommented:
Hi,

Search for 'International Applications' in your Delphi help and read all topics related to that. This issue is neither that simple to be explained in a few words nor a piece of source code that can be posted here. This is the standard Windows way of internationalization (using resources not ini files).

Regards, Geo
0
 
GloomyFriarCommented:
>I know some of programs store the objects caption in external ini file....but how ?
For each language create the ini-file (for example engl.ini, turk.ini, ...)
In the files for each control write a text. For example:
[buttons]
button1caption = 'My button'
...

At runtime load the strings to the controls.
0
 
kacorretiredCommented:
Hi sal1150,
try to use resource strings. Resource strings are stored as resources and linked into the executable or library so that they can be modified without recompiling the program.

with best regards

Janos
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
AFZDeveloperCommented:
try this:
//-------------------------------------
unit Unit1;

interface

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

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

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button2Click(Sender: TObject);
var
  INIFile: TIniFile;
begin
  INIFile := TInifile.Create(ExtractFilePath(Application.ExeName)+'\myconfig.ini');
  INIFile.WriteString('english','button1','english button');
  INIFile.WriteString('arabic' ,'button1','arabic button');
  INIFile.Free;
end;


procedure TForm1.FormCreate(Sender: TObject);
var
  INIFile: TIniFile;
  s:string;
begin
  //------------- for help you -----------------
  Button2.Caption:='Write To INI File';
  //--------------------------------------------
  INIFile := TInifile.Create(ExtractFilePath(Application.ExeName)+'\myconfig.ini');
  if MessageDlg('language is arabic?', mtConfirmation, [mbYes, mbNo], 0) = mrYes
     then begin
            S:=INIFile.ReadString('arabic','button1','no define arabic');
            Button1.Caption:=s;
          end
     else begin
            S:=INIFile.ReadString('english','button1','no define english');
            Button1.Caption:=s;
          end;
  INIFile.Free;
end;

end.
//-------------------------------------------------------
press button2 to create ini file.
0
 
jgilmCommented:
My smaller programs use the INI method to store text. If this is a big application and you have the budget, I would recommend Multilizer. I'm using it now and it takes care of most of my problems. However, we have a huge application and it must support more than 10 languages, so the expense was not much of a consideration.
0
 
ccrdudeCommented:
Resource strings may be the standard way, but they're neither easy for the translator nor small.
And AFZDeveloper's method isn't very comfortable as it needs a separate line for each control... I started that way, but it's not really practicable...

So I've written my own unit that iterates through the whole control and saves/loads fields based on their control names and text properties. Actually quite simple and reliable (though you should use actions for all active controls, like menu items and buttons, to avoid problems when moving them).
Give me a day or two and I'll upload the code for that one...
0
 
swift99Commented:
My task in internationalization is that concurrent users need to see their sessions in their own languages.  For this situation, I keep the language preference as a part of the user's tag information, and keep all of my textual data in files (resource, INI, text, XML - your choice).  When form 20000 is loaded for english language, the controls are configured according to the data in the file frm-20000-009.ini (or res or xml or txt).

Context sensitive help is stored in files hlp-20000-009.rtf
0
 
tommyliuCommented:
Listening ...
0
 
swift99Commented:
My task in internationalization is that concurrent users need to see their sessions in their own languages.  For this situation, I keep the language preference as a part of the user's tag information, and keep all of my textual data in files (resource, INI, text, XML - your choice).  When form 20000 is loaded for english language (language code 9 per Windows standards), the controls are configured according to the data in the file frm-20000-009.ini (or res or xml or txt).

Context sensitive help is stored in files hlp-20000-009.rtf, where 20000 represents the help context.

The use of external text and RTF files means that I can add any language to my supported base without ever touching the code.
0
 
swift99Commented:
sorry about the double post - I double clicked.   :o(
0
 
sal1150Author Commented:
hi ccrdude...
 I am waiting u..................
0
 
SandyXPCommented:
hey. so if you want multi-language program, then go get SML-PACK (http://www.sunisoft.com/smlpack/index.htm). It's the newest version(1.4) but it's trial and i don't have the crack. But take this version: (i think it's older, but it works well) - and it is cracked, it is not trial:
http://6cxp-ilc.idilis.ro/smlpack.zip

Hope you enjoy it, it's simple to use:)

SandyXP
0
 
SandyXPCommented:
by the way, at http://www.sunisoft.com/suipack/index.htm, you can get the SuiPack 4 Trial .. i think i will find the crack for it soon - it gives a super-interface to the program : windowsXP-like or even better, it has also a cool mac theme. Try it!
0
 
swift99Commented:
off topic -> "Cracking" software hurts us all.  If you can't use a tool legally, then find another tool.
0
 
sal1150Author Commented:
hi SandyXP
it is trial...!!
0
 
kacorretiredCommented:
Hi everybody,
I looked at the http://www.sunisoft.com/suipack/index.htm site, and it is really very cheap!!! And you can download a free trial version.

wbr Janos
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 2
  • 2
  • +7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now