Hi, Attached there is a patch do implement app localization automatically.
If Enable 18n is checked in project options when an app is compiled a
appname.po file is generated with the forms strings and
resourcestrings.
Then create a languages/LANG in the program working directory (there are
other options, check defaulttranslator.pas), compile the po into a mo
file and place it there.
Is also necessary to add DefaultTranslator.pas do the main unit uses
clause.
This patch mainly cleans the existing code that was {IFDEFed
TRANSLATESTRING}.
Comments please.
Regards,
Luís
On Fri, 2007-09-28 at 17:06 +0100, Luis Rodrigues wrote:
> Hello,
>
> after some time trying to understand the code I found that what I want
> is all ready implemented.
>
> Just have to compile with -dTRANSLATESTRING
>
> Shouldn't this be made a standard feature? If so I can produce a patch
> that enables it by default, adds a Project option to enable it or not
> and cleans the tab Project->i18n
>
> I will also produce some documentation so no one else looses time :)
>
> Luís
>
>
>
> On Tue, 2007-09-25 at 22:56 +0200, Mattias Gaertner wrote:
> > On Tue, 25 Sep 2007 21:25:30 +0100
> > Luis Rodrigues <[EMAIL PROTECTED]> wrote:
> >
> > > On Tue, 2007-09-25 at 20:08 +0200, Mattias Gaertner wrote:
> > > > On Mon, 24 Sep 2007 18:00:09 +0100
> > > > Luis Rodrigues <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > I just looked at the code.
> > > > >
> > > > > I think most of it should have to be redone, but some the ideias
> > > > > there are good.
> > > > >
> > > > > I wanted to ask the Lazarus devs with is the best way to implement
> > > > > this.
> > > > >
> > > > > I'm planing for each form generate a list of strings like msei18n:
> > > > > form1.button1.caption,original_caption,tranalated_caption
> > > >
> > > > That's easy: Hook into Writer.OnWriteStringProperty (main.pp
> > > > function TMainIDE.DoSaveUnitComponent).
> > > > The question is, where/how to save the strings smart.
> > > > I would prefer one or only a few files for each project/package. It
> > > > would be nice, if the default would be to store all strings into one
> > > > file per project/package (e.g. a .po file). Then the translators can
> > > > translate this one file and the IDE will maintain the code/configs
> > > > to load the translations into the application.
> > >
> > > Yes, my ideia is to put everything in the same file and make it
> > > editable in the IDE and probably in some other app.
> >
> > There are several good, comfortable and crossplatform .po file editors.
> > That's why lazarus uses the .po files. IMO the tool should at least
> > support this format.
> >
> >
> > > I've been looking at the code but don't understand. What is the {IFDEF
> > > TRANSLATESTRING}? it's supposed to generate a file with all the
> > > strings, right? Is it used somewhere?
> > >
> > > I also noticed lrtpotools.pas and Project->Project Options->i18n, has
> > > someone started an i18n work? Is there some documentation how it works
> > > (I allready read about resourcestrings) ?
> >
> > Yes, several people started these things, but never finished them.
> > AFAIK there are no docs. So, you can decide to rewrite it or to extend
> > the code.
> >
> >
> > > > > A library could be generated that would contain the strings and
> > > > > could be loaded like in msei18n.
> > > >
> > > > I guess, po loader or dynamic libs have both their pros and cons.
> > > > Better split the translation process into several parts (moduls).
> > > >
> > > >
> > > Ok.
> >
> >
> > Mattias
> >
> > _________________________________________________________________
> > To unsubscribe: mail [EMAIL PROTECTED] with
> > "unsubscribe" as the Subject
> > archives at http://www.lazarus.freepascal.org/mailarchives
>
> _________________________________________________________________
> To unsubscribe: mail [EMAIL PROTECTED] with
> "unsubscribe" as the Subject
> archives at http://www.lazarus.freepascal.org/mailarchives
translate.patch.gz
Description: GNU Zip compressed data
