[fpc-pascal] Localized version of my application

Csányi Pál csanyipal at gmail.com
Sun Jul 6 20:17:37 CEST 2008


Mattias Gaertner <nc-gaertnma at netcologne.de> writes:

> On Sun, 06 Jul 2008 16:11:48 +0200
> csanyipal at gmail.com (Csányi Pál) wrote:
>> I wish to localize this application to Hungarian language.

>> tutorial I have now the project.po, project.mo, project.hu.po,
>> project.hu.mo files.
>> 
>> In this project I have source files: project.lpr and
>> projectunit1.pas. 
>> 
>> project.lpr uses unit projectunit1.pas.
>> 
>> I put the code that should to call TranslateUnitResourceStrings of the
>> LCL translations unit in the project.lpr file:
>> 
>> ------------>
>> program project;
...
>> var
>>   PODirectory, Lang, FallbackLang: String;
>> 
>> begin
>>   Application.Title:='project';
>>   Application.Initialize;
>>     Lang := '';
>>     FallbackLang := '';
>>     PODirectory := 'locales/';
>>     //projectdirectory/locales/
>>     GetLanguageIDs(Lang, FallbackLang); // in unit gettext
>>     TranslateUnitResourceStrings('project', PODirectory + 
>>      'project.%s.po', Lang, FallbackLang);
>>   Application.CreateForm(TForm1, Form1);
>>   Application.Run;
>> end.
>> ------------<
>> 
>> This dosn't works.

> Some work has been done on automatic storing the forms strings into .po
> files and reading them back again. But there are many things left to
> do. That's why there is only a simple unit (lcl/defaulttranslator.pas)
> to load the strings. And this comes without documentation and has
> several limitations.

> Maybe it's better to use ResourceStrings.

Maybe yes but I have a cue to try out DefaultTranslator in my code. 

I'm reading now the lcl/defaulttranslator.pas. I like it. :)

I'm a novice in the freepascal and object pascal so I don't know how
to call DefaultTranslator?

If you think that that for me it's worth to try it out, then you
could, if you want, or have a time, to give to me advices how to use
it. Want you?

-- 
Regards, Paul Csanyi
http://www.freewebs.com/csanyi-pal/index.htm



More information about the fpc-pascal mailing list