Solved

multi language for my program

Posted on 2003-10-28
16
300 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
 
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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 this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now