Home
 
 
SImg
Features
Screenshots
 
Other
projects

jsMovie
lx200ctl
eq6update-config
pgettext
xetoxe2
ramtest
 
Download
 
Links
 
 

pgettext

What is pgettext

It is a gettext package for Freepascal and consists in a unit which provides C like gettext support (via procedures) and some useful utilities.

Download

pgettext.tar.bz2    (pgettext, sources)

Utilities

pgtupdate
Searches for new msgid's in pascal sources and appends them to a .po file. The line numbers of all msgid's are updated.
Usage:
./pgtupdate <.po file> <function name> [<file1> [<file2> ... ]]
    <.po file>        The .po file which should be updated 
    <function name>   gettext or the wrapper for dgettext (e.g. pgt)
Example:
./pgtupdate po/de.po pgt *.pas
pgtspell
Spell checks and corrects a .po file. Misspelled msgid's are replaced in the sources if possible. Therefore the line numbers should be up to date. (Run pgtupdate in necessary)
Usage:
./pgtspell <.po file> <msgstr check> [<msgid check>]
    <msgstr check>   Spell check command for msgstr's ("" for no spell check)
    <msgid check>    Spell check command for msgid's ("" for no spell check)
Example:
./pgtspell pd/de.po "aspell -d de -c" "aspell -d en -c"
pgtsrcspell
Spell checks msgid's in source code.
Usage:
./pgtsrcspell <function name> <check command> [<file1> [<file2> ... ]]
    <function name>   gettext or the wrapper for dgettext (e.g. pgt)
    <check command>   Spell check command for occurrences
Example:
./pgtsrcspell pgt "aspell -d en -c" *.pas

Files

pgtintl.pas
The main unit (similar to intl)
pgtupdate.pas
Search for new msgid's in sources and adds them to .po file (see below)
pgtspell.pas
Spell checks a .po file (also correct sources, see below)
pgtsrcspell.pas
Spell checks msgid's in sources (see below)
pgttools.pas
Unit which contains the routines for pgtupdate, pgtspell and pgtsrcspell
Readme
This file
po/*.po
.po files for utilities
pospell.sh
Spell checks po/*.po
poupdate.sh
Adds new msgid's to po/*.po
Readme.po
Description of the scripts pospell.sh and poupdate.sh
Copying
GNU GPL License
Makefile
Makefile
update
creates Makefile after changes of source
update.utils
routines for update

Installation

make
make install
The first command builds the package, the second installs it. The default unit directory is /usr/local/lib/fpc/pgettext. Edit the makefile to change the installation directories.

Usage

The suggested usage is:
  1. Make the unit pintl available for your program.
  2. Insert this into your source:
    uses pintl;
    
  3. Insert
    pbindtextdomain(your_package_name, your_localedir);
    
    into the initialization part of your program, where your_package is the base name of your .po file (e.g. 'pgettext') and your_localedir is the directory where the .mo file can be found (e.g. '/usr/local/share/locale' or dirname(paramstr(0))+'/po').
  4. Define a wrapper function like this:
    function mygt(const msgid:ansistring):ansistring;
    begin
    mygt:=pdgettext(your_package_name,msgid);
    end;
    
  5. Put the strings, that should be translated, into the wrapper function, e.g.
    writeln('Translate me'); --> writeln(mygt('Translate me'));
    
  6. Create the .po file (e.g. with pgtupdate, see below)
  7. Build the .mo file from the po file, e.g:
    msgfmt your_package_name.po -o your_package_name.mo
    
  8. Copy the .mo into your_localedir.


[Home]  [Download]    email
© Copyright 1999-2004 by Stefan Ziegenbalg. All rights reserved.