(root)/
gettext-0.22.4/
gettext-tools/
doc/
lang-pascal.texi
@c This file is part of the GNU gettext manual.
@c Copyright (C) 1995-2020 Free Software Foundation, Inc.
@c See the file gettext.texi for copying conditions.

@node Pascal
@subsection Pascal - Free Pascal Compiler
@cindex Pascal
@cindex Free Pascal
@cindex Object Pascal

@table @asis
@item RPMs
fpk

@item Ubuntu packages
fp-compiler, fp-units-fcl

@item File extension
@code{pp}, @code{pas}

@item String syntax
@code{'abc'}

@item gettext shorthand
automatic

@item gettext/ngettext functions
---, use @code{ResourceString} data type instead

@item textdomain
---, use @code{TranslateResourceStrings} function instead

@item bindtextdomain
---, use @code{TranslateResourceStrings} function instead

@item setlocale
automatic, but uses only LANG, not LC_MESSAGES or LC_ALL

@item Prerequisite
@code{@{$mode delphi@}} or @code{@{$mode objfpc@}}@*@code{uses gettext;}

@item Use or emulate GNU gettext
emulate partially

@item Extractor
@code{ppc386} followed by @code{xgettext} or @code{rstconv}

@item Formatting with positions
@code{uses sysutils;}@*@code{format "%1:d %0:d"}

@item Portability
?

@item po-mode marking
---
@end table

The Pascal compiler has special support for the @code{ResourceString} data
type.  It generates a @code{.rst} file.  This is then converted to a
@code{.pot} file by use of @code{xgettext} or @code{rstconv}.  At runtime,
a @code{.mo} file corresponding to translations of this @code{.pot} file
can be loaded using the @code{TranslateResourceStrings} function in the
@code{gettext} unit.

An example is available in the @file{examples} directory: @code{hello-pascal}.