Solved

Multilange

Posted on 2004-04-21
3
233 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
[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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

756 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