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 - Attach:GettextFA.zip Δ

Updating the empty.po files

#!/bin/bash

mkdir -p /var/www/frontac
cd /var/www/frontac

FRONTACFILE=FrontAc_default_Mer_3127_2012-12-20.tar.gz

wget http://www.apmuthu.com/bugfixes/$FRONTACFILE
tar -xzf $FRONTACFILE
rm -f $FRONTACFILE

MAINDIR=`pwd`/

# 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

TPL=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/$TPL.po $MAINDIR/$TPL.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/$TPL.po

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

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