🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internationalization
Article #24

Application translation problem

#24
From: Andre
Date: Thu, 19 Apr 2007 12:30
37 lines
2007 bytes
Hi,

   I am trying to find a better way to translate an
application I have.

   I am using BC++ Builder 6. The strings I have in the code (.cpp or
.h) are gathered to a single header file (trans.h) wich contains defines
for  each translation. I control wich group of #defines are used with
"#idef LANG1", etc. And every string in each control of the forms I
have, is initialized in its constructor. Example:

#include "trans.h"
(...)
__fastcall TFormMy::TFormMy(TComponent* Owner)
         : TForm(Owner)
{
     #ifdef LANG1
         Caption = "Title in LANG1";
     #elif defined LANG2
         Caption = "Title in LANG2";
     #endif
}

   Where TFormMy is my app's main form, and it defines each title based
on the language defined in the file "trans.h".

   I think the problem with this approach is that I generate code that
maybe unnecessary. The forms (and its controls) already have strings
kept inside them, and the constructor overrides them this way, right?

   How could I change the strings at compilation time, but without this
extra code?

   Thanks,

Andre.
			
Technical Details
Message-ID: <462760b1$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10297d,122fdb91458a8252,start
X-Google-Attributes: gid10297d,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Thu, 19 Apr 2007 09:30:42 -0300
From: Andre <avic@bios.srv.br>
User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
X-Accept-Language: pt-br, pt
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internationalization
Subject: Application translation problem
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 201.80.7.55
Message-ID: <462760b1$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1176985777 201.80.7.55 (19 Apr 2007 05:29:37 -0800)
Lines: 37
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail