Purpose
To install language files which represent the language/accounting requirements of different Countries/Locations
Procedure
- Download the appropriate Language file from the Sourceforge Downloads page: http://sourceforge.net/projects/frontaccounting/files/ and extract.
- Log on to your Frontaccounting installation as admin using Training Company. Go to Setup>Install/Update Languages.
- Enter a Language Code (eg Eng_CAN ), Language Name and Encoding. Encoding can usually be found using Firefox by loading the .po file from your language folder into Firefox and going to View>Character Encoding
- Browse for the .po and .mo files in the folder you extracted. Make any other selections as needed.
- Click Save to upload the files to your server
- If the language file you require doesn't exist on the Sourceforge server you can create your own .po and .mo files using Poedit as indicated here: http://frontaccounting.com/wb3/pages/download/download-languages.php Simply use Poedit to alter an existing .po language file where you wish to change it and save to your new language folder. Then update the language as above. In Windows, the program C:\Program Files\Poedit\bin\msgunfmt.exe can be used to revert a compiled .mo file back into a .po file to be edited and then re-compiled using C:\Program Files\Poedit\bin\msgfmt.exe. The command msgunfmt.exe -o en_US.po en_US.mo in a DOS box does the reversion.
- Locale settings in various OSes
- PHP setlocale()
- Must logout of FA and login again for any language change to take effect.
PDF Printing Issues for Tamil Unicode
Issues pertaining to PDF printing of PDF in Tamil Languages are discussed in the Unofficial GitHub repo.
Default contents of lang/installed_languages.inc
<?php /* How to make new entries here for non-packaged languages: -- 'code' should match the name of the directory for the language under \lang .-- 'name' is the name that will be displayed in the language selection list (in Users and Display Setup) -- 'rtl' only needs to be set for right-to-left languages like Arabic and Hebrew -- 'encoding' used in translation file -- 'version' always set to '' for manually installed languages. -- 'path' installation path related to FA root (e.g. 'lang/en_US'). */ $installed_languages = array ( 0 => array ( 'code' => 'C', 'name' => 'English', 'encoding' => 'iso-8859-1', ), ); $dflt_lang = 'C'; ?>
Tips and Tricks
Arabic in FA
- In linux, install the Arabic locale:
locale-gen ar_EG.utf8
- Install ar_EG Arabic Language within FA
- Edit the encoding in lang/installed_languages.inc to be 'utf-8' for ar_EG language
- Upload the Arabic fonts (aealarabiya and aefurat) to the reporting/fonts folder
- Edit lines 158 in reporting/includes/class.pdf.inc to be:
case "ar_EG" : $fontname = "aealarabiya"; break;
- When logged in, make your language preference for the UI to be Arabic.
- Now all reports will be in Arabic - Screenshot.
Chinese language reports
- Download the fontfile from the website download section.
- Unpack and copy the unpacked files into folder /reporting/fonts
- You may not find the file gbsn00lp.php, but use instead stsongstdlight.php from the tcpdf package
- Change Line 159 in /reporting/includes/class.pdf.inc to
' case "zh_CN" : $fontname = "stsongstdlight"; break; '
- Printing Chinese and English is now available
Entering data in different languages without changing the language of FrontAccounting
If you need to accept foreign characters you must either set your language charset to utf-8 or the appropriate iso-8859-X, where the X is a number representing your language. This way the html is stamped with the charset used.
- Go to the Setup tab in FrontAccounting as an admin.
- Enter Install/Update Languages and change the encoding for the en_GB (US) language to utf-8 or iso-8859-X where x is the number representing your language. This will create utf-8 html pages.
- Then you must install a unicode font, otherwise creating PDF's will throw an error.
Changing language of FA
lang/installed_languages.inc file contains the encoding type - change it to be UTF-8 like:
# 'encoding' => 'iso-8859-1', 'encoding' => 'utf-8',
The resulting PDF files will be quite heavy.
On a linux machine, locale -a would show the languages available. If a certain Spanish encoding like es_EC does not appear in the list and we need it, then sudo locale-gen es_EC would generate it and possibly prevent oversized PDF files.
If locale -a does not show the languages necessary, then run the command dpkg-reconfigure locales and choose the locales generated that are needed. Now, locale -a would show the languages available. It is assumed that the dependancy debconf has been installed. Reference: Debian Locales
Manual Install of New Language
The assumption is that the appropriate language .mo and .po files have been made and are available on a local desktop or as illustrated here, as a zip file and are being installed in a Debian (Physical / Virtual) Machine:
WEBROOT=/var/www/frontac LANGNAME=en_IN LANGVER=2.3.15-1 cd ${WEBROOT}/modules/_cache wget http://www.apmuthu.com/files/${LANGNAME}-${LANGVER}.zip unzip ${LANGNAME}-${LANGVER}.zip chown -R www-data:www-data ${WEBROOT}/modules/_cache/${LANGNAME}-${LANGVER} mkdir -p ${WEBROOT}/lang/${LANGNAME} rm -rf ${WEBROOT}/lang/${LANGNAME}/* mv ${WEBROOT}/modules/_cache/${LANGNAME}-${LANGVER}/LC_MESSAGES ${WEBROOT}/lang/${LANGNAME}
The contents of the _init/config file in the downloaded zip file above are:
Package: en_IN Version: 2.3.15-1 Description: India specific vocabulary fixes Author: Ap.Muthu <apmuthu@usa.net> Maintenance: Ap.Muthu <apmuthu@usa.net> Homepage: n/a Language: en_IN Encoding: iso-8859-1 RTLDir: no Depends: Type: language Name: English (IN) InstallPath: lang/en_IN Filename: en_IN-2.3.15-1
The contents of the _init/files file are:
/LC_MESSAGES/en_IN-2.3.15-1.mo: 713e020993b549dbc838d66e838570d7184eafad /LC_MESSAGES/en_IN-2.3.15-1.po: 2a19d338a12bef131967d537298ab0589e407805 /_init/config: 0930aae512a3b8704c7b2e9f5d06938e98110160
The above file contains the SHA1SUM of the working files in the zip file that was downloaded. It can be generated from an existing installed (or suitably uploaded fileset) setup using:
WEBROOT=/var/www/frontac LANGNAME=en_IN LANGVER=2.3.15-1 cd ${WEBROOT}/lang/${LANGNAME} find ./ -type f -print0 | xargs -0 sha1sum | awk '{ print $2 ": " $1}' | cut -c2- \ > ${WEBROOT}/modules/_cache/${LANGNAME}-${LANGVER}/_init/files cd ${WEBROOT}/modules/_cache/${LANGNAME}-${LANGVER} find ./ -type f -print0 | xargs -0 sha1sum | awk '{ print $2 ": " $1}' | cut -c2- | grep /_init/config: \ >> ${WEBROOT}/modules/_cache/${LANGNAME}-${LANGVER}/_init/files
The required file is at and as /var/www/frontac/modules/_cache/en_IN-2.3.15-1/files and can be used to make a Language extension zip file for manual install in this manner.
For the FrontAccounting application to be informed of this language extension, the ${WEBROOT}/lang/installed_languages.inc file needs to have an array entry like:
... ... $installed_languages = array ( 0 => array ( 'code' => 'C', 'name' => 'English', 'encoding' => 'iso-8859-1', ), 1 => array ( 'code' => 'en_IN', 'name' => 'English (IN)', 'package' => 'en_IN', 'encoding' => 'iso-8859-1', 'version' => '2.3.15-1', 'path' => 'lang/en_IN', ), ... ...
The resultant language strings after setting user language preferences to the new language would be:
EMail Language
The language used in emails is hardcoded in Line 41 of reporting/includes/class.mail.inc:
var $charset = 'ISO-8859-1';
Change it to suit your needs if different from the standard English character set above.