Solved

Multilange

Posted on 2004-04-21
3
232 Views
Last Modified: 2010-04-05
Hi all,

I want to make a multi language app where the user can easily make changes in a text file.
The app then reads the file at startup and replaces label captions and so on.
Any suggestions?

Svenj
0
Comment
Question by:svenj
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 500 total points
ID: 10877160

   just a quick idea

   TEntityForm = class(TForm)
   ...
   private
      procedure GetLocales;
   public
   end;

   procedure TEntityForm.GetLocales;
   var
     counter : Integer;
   begin
     // read from sowhere the localized values - Database ot local file
     for counter := 0 to Self.ComponentCount - 1 do
        begin
           if Self.Components[counter] is TLabel then
              (Self.Components[counter] as TLabel).Caption := 'localized value';
           if Self.Components[counter] is TEdit then
              (Self.Components[counter] as TEdit).Text := 'localized value';
        end;
   end;


  Your localization file should look like this

  FormName  Component          Value
------------------------------------------------
  Form1         Label1                 Text
  Form1         Edit1                   TestEdit

  when you load Form1 - you read the values for Form1 only.

0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10877167

  the localization file can be in INI format

  [Form1]
  Label1=Text
  Edit1=TestEdit

  ....
0
 

Expert Comment

by:Sneaky_Pie
ID: 10966717
If you are looking for complete tool, try GNU Gettext for Delphi:
https://sourceforge.net/projects/dxgettext/

It's an open source project with mpl 1.1 license. I'm using it in several projects without any problems. The format of the translation files is po, thats a text format.
And, as an advantage, you can translate your application in a lot of languages. There are several delphi translations available.

Sneaky Pie
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to debug For loops? 3 56
RESTRequest Parameter 4 41
scroll down TListBox component in Delphi 1 19
Delphi Seattle StructureView color 1 14
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…

791 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