[fpc-pascal] Localized version of my application
Csányi Pál
csanyipal at gmail.com
Sun Jul 6 16:11:48 CEST 2008
Hello!
I have installed Lazarus Version #: 0.9.25 beta Date: 2008-06-18 and
FPC Version: 2.2.0 SVN Revision: 15441M i386-linux-gtk 2 (beta).
I made a small project with Lazarus with one Frame, Buttons, Labels
and StaticTexts. All these elements have English text as Caption.
I wish to localize this application to Hungarian language.
Following the
http://wiki.lazarus.freepascal.org/Translations_/_i18n_/\
_localizations_for_programs
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 projectunit1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms
{ you can add units after this }, projectunit1,
gettext, translations;
{$IFDEF WINDOWS}{$R projectunit1}{$ENDIF}
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.
Localization is not so simple as I think?
Please give me some advice what should I do now to get localized my
application?
I tried to add a Breakpoint after
GetLanguageIDs(Lang, FallbackLang); // in unit gettext
line to see wether Lang and FallbackLang variables get some values,
but I don't know where to find this values after the run of the
project stop at this point?
Any advice will be appreciated!
--
Regards, Paul Csanyi
http://www.freewebs.com/csanyi-pal/index.htm
More information about the fpc-pascal
mailing list