Solved

multi language for my program

Posted on 2003-10-28
16
308 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
[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
  • 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
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!

 
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: 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

Suggested Solutions

Title # Comments Views Activity
QRReport  TQrmemo vertical stretching 1 68
Is anyone willing to have a look through this code and help debug? 25 104
update joined tables 2 74
Firemonkey Queue list 1 51
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…

710 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