empty.po File Locations and Info

The English ISO-8859-1 (Latin 1) strings that are the default in FrontAccounting, are parsed using gettext and are available at:

  • Application Strings - WEBROOT/lang/new_language_template/LC_MESSAGES/empty.po
  • Installer Strings - WEBROOT/install/lang/new_language_template/LC_MESSAGES/empty.po
  • Both files are normal text files with linux line endings (0x0A)
  • gettext and FrontAccounting - GettextFA.sh Δ

Updating the empty.po files

#!/bin/bash

mkdir -p /tmp/fagettext
cd /tmp/fagettext

FAVERSION="2.3.14"
FRONTACFILE=frontaccounting-$FAVERSION.tar.gz

wget http://sourceforge.net/projects/frontaccounting/files/FrontAccounting-2.3/$FAVERSION/$FRONTACFILE
tar -xzf $FRONTACFILE
rm -f $FRONTACFILE

MAINDIR=`pwd`/frontaccounting

cd $MAINDIR

# Generate the main empty.po file

TPL=lang/new_language_template/LC_MESSAGES/empty
GTEXEC="xgettext  -d empty --language=PHP  --from-code=ISO-8859-1 \
                  -p $MAINDIR/lang/new_language_template/LC_MESSAGES "

# Backup the old main empty.po
mv $MAINDIR/$TPL.po $MAINDIR/$TPL.po.org

# Generate main header as well
$GTEXEC -k_ -n *.php

# set the charset
sed -i 's/charset=CHARSET/charset=ISO-8859-1/g' $MAINDIR/$TPL.po


mv install ..

$GTEXEC -k_ -n -j */*.php
$GTEXEC -k_ -n -j */*/*.php
$GTEXEC -k_ -n -j */*/*/*.php
$GTEXEC -k_ -n -j */*.inc
$GTEXEC -k_ -n -j */*/*.inc
$GTEXEC -k_ -n -j */*/*/*.inc

mv ../install .

# Generate the install empty.po file

ITPL=install/lang/new_language_template/LC_MESSAGES/empty
GTEXEC="xgettext  -d empty --language=PHP  --from-code=ISO-8859-1 \
                  -p $MAINDIR/install/lang/new_language_template/LC_MESSAGES "

# Backup the old install empty.po
mv $MAINDIR/$ITPL.po $MAINDIR/$ITPL.po.org

# Generate install header as well
$GTEXEC -k_ -n install/*.php

# set the charset
sed -i 's/charset=CHARSET/charset=ISO-8859-1/g' $MAINDIR/$ITPL.po

$GTEXEC -k_ -n -j install/*.inc
$GTEXEC -k_ -n -j includes/system_tests.inc
$GTEXEC -k_ -n -j includes/packages.inc

cd $MAINDIR
tar -czf ../../fac_empty_po.tar.gz $TPL.po $ITPL.po
cd ../..
rm -rf fagettext

echo "fac_empty_po.tar.gz created"

Translation to another language

During translation to any other language, make a copy of the empty.po file as the target language file, ie., example for Polish language:

LANG=pl_PL
MAINVER=0

MAINDIR=`pwd`/

## Creating the main .mo file
LANGDIR=$MAINDIR/lang/$LANG/LC_MESSAGES
TPL=lang/new_language_template/LC_MESSAGES/empty
cp $TPL.po $LANGDIR/$LANG.po
## Edit the charset (ISO-8859-2) and strings and compile the .po file to .mo file using msgfmt

## Creating the install .mo file
LANGDIR=$MAINDIR/install/lang/$LANG/LC_MESSAGES
TPL=install/lang/new_language_template/LC_MESSAGES/empty
cp $TPL.po $LANGDIR/$LANG.po
## Edit the charset and strings and compile the .po file to .mo file using msgfmt

Poedit on WinXP

  • Place your mylang.po file in the folder: C:\Program Files\Poedit\bin
  • Start -> Run -> cmd
  • cd C:\Program Files\Poedit\bin* msgfmt mylang.po
  • Take the mylang.mo file from the same folder.

PoEditors

  • Poedit - SF project is cross-platform gettext catalogs (PO files) editor (Beware of 70 character limitation)
  • Better Poeditor used to generate compiled gettext .mo files.
  • Multi Po-edit is a Java swing .po file editor that displays comments, ids, and translations in a JTable. Multiple files can be compared and IDs can be looked up to see what files will be affected by the change.
  • Massively Parallel PO Editor for editing multiple language files in parallel. Corresponding translations are automatically highlighted in order to aid reviewing against multiple sources.