Solved

multi language for my program

Posted on 2003-10-28
16
305 Views
Last Modified: 2010-04-05
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
Comment
Question by:sal1150
  • 4
  • 2
  • 2
  • +7
16 Comments
 
LVL 17

Expert Comment

by:geobul
ID: 9633908
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
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9633923
>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
 
LVL 10

Expert Comment

by:kacor
ID: 9634232
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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 3

Assisted Solution

by:AFZDeveloper
AFZDeveloper earned 250 total points
ID: 9635840
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
 

Expert Comment

by:jgilm
ID: 9637000
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
 
LVL 2

Assisted Solution

by:ccrdude
ccrdude earned 50 total points
ID: 9637705
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
 
LVL 6

Expert Comment

by:swift99
ID: 9638958
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
 
LVL 1

Expert Comment

by:tommyliu
ID: 9638964
Listening ...
0
 
LVL 6

Accepted Solution

by:
swift99 earned 50 total points
ID: 9638994
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
 
LVL 6

Expert Comment

by:swift99
ID: 9639005
sorry about the double post - I double clicked.   :o(
0
 

Author Comment

by:sal1150
ID: 9639772
hi ccrdude...
 I am waiting u..................
0
 

Assisted Solution

by:SandyXP
SandyXP earned 150 total points
ID: 9645632
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
 

Expert Comment

by:SandyXP
ID: 9645660
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
 
LVL 6

Expert Comment

by:swift99
ID: 9646127
off topic -> "Cracking" software hurts us all.  If you can't use a tool legally, then find another tool.
0
 

Author Comment

by:sal1150
ID: 9646620
hi SandyXP
it is trial...!!
0
 
LVL 10

Expert Comment

by:kacor
ID: 9648175
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

820 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