[fpc-pascal]gettext
Sebastian Günther
sguenther at gmx.de
Thu Sep 12 20:56:15 CEST 2002
Stefan Ziegenbalg schrieb:
> Hi,
>
> is there a way to translate const strings manual, like gettext or
> dgettext in C?
yes... use the gettext unit provided in the FCL.
TMOFile = class
...
constructor Create(const AFilename: String);
constructor Create(AStream: TStream);
...
function Translate(AOrig: String): String;
end;
so just use it this way:
TranslStrings := TMOFile('test.mo');
try
WriteLn('Translated: ', TranslStrings.Translate('Some test string'));
finally
TranslStrings.Free;
end;
In the long term I think we'll switch to a procedural approach, so that
gettext can be used within the RTL.
- Sebastian
More information about the fpc-pascal
mailing list