Topic: Change display language from English to another

Hi there

I have a new laptop and I have install XAMPP for local use, then I install new fresh FrontAccounting 2.3.24

I try to change the language from English to another language but it is not working.

Please checks is it working in the latest version!?

I try in this way:
1. Login as administrator to the default company
2. Setup - Install/Update Languages and I have put different language from english.
3. Setup - User Accounts Setup - Language and I have seen there is a new language selected
4. Preferences - Language - ( there is also new language)
6. I logout and Login again but there is no change it is again english.

Please help ....

Re: Change display language from English to another

Did you try it on WAMP.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Change display language from English to another

Use the latest snapshot of the stable version.

Re: Change display language from English to another

in XAMPP. its not working, even mine is also not working the language translations sometime.

Subscription service based on FA
HRM CRM POS batch Themes

5 (edited by apmuthu 10/28/2015 08:12:54 am)

Re: Change display language from English to another

In XAMPP it will work only if the gettext() function is available to PHP:

<?php
$func = "gettext";
if (function_exists($func)) echo "Yes, $func() exists";
else echo "No, $func() does not exist";

What do your error logs say?

Check how your version of windows perceives your locale names:
https://bugs.php.net/bug.php?id=66265

6 (edited by apmuthu 10/28/2015 06:51:30 pm)

Re: Change display language from English to another

Windows uses 3 character locale names in (PHP 5.3.1 atleast) alomg with language_Country.encoding format for LC_CTYPE:

<?php
echo setlocale(LC_ALL, 0) . "\n";
// LC_COLLATE=C;LC_CTYPE=English_United States.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C

setlocale(LC_CTYPE, 'Bulgarian_Bulgaria.1251');
echo setlocale(LC_ALL, 0) . "\n";
// LC_COLLATE=C;LC_CTYPE=Bulgarian_Bulgaria.1251;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C

setlocale(LC_CTYPE, 'Tamil_India.1252');
echo setlocale(LC_ALL, 0) . "\n";
// LC_COLLATE=C;LC_CTYPE=Tamil_India.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C

setlocale(LC_ALL, "fra_fra");
echo strftime("%A %d %B %Y", mktime(0, 0, 0, 12, 22, 1978));
/* Output nld_nld: vrijdag 22 december 1978 */
/* Output deu_deu: Freitag 22 Dezember 1978 */
/* Output fra_fra: vendredi 22 décembre 1978 */

Pay attention to the syntax.
- UTF8 without dash ('-')
- locale.codeset and not locale-codeset.

<?php
$codeset = "UTF8";  // warning ! not UTF-8 with dash '-'
       
// for windows compatibility (e.g. xampp) : theses 3 lines are useless for linux systems

putenv('LANG='.$lang.'.'.$codeset);
putenv('LANGUAGE='.$lang.'.'.$codeset);
bind_textdomain_codeset('mydomain', $codeset);

// set locale
bindtextdomain('mydomain', ABSPATH.'/locale/');
setlocale(LC_ALL, $lang.'.'.$codeset);
textdomain('mydomain');
?>

where directory structure of locale is (for example) :

locale/fr_FR/LC_MESSAGES/mydomain.mo
locale/en_US/LC_MESSAGES/mydomain.mo

and ABSPATH is the absolute path to the locale dir

Further note, under linux systems, it seems to be necessary to create the locale at os level using 'locale-gen'.

Ref:
http://php.net/manual/en/function.setlocale.php
https://msdn.microsoft.com/en-us/library/x99tb11d%28v=vs.140%29.aspx

7 (edited by apmuthu 11/04/2015 10:18:47 pm)

Re: Change display language from English to another

Even after installing the necessary locales in Windows (before starting Apache) if you cannot get gettext to work for locales other than the default one, then use the php-gettext workaround.
1. Disable the gettext extension in the php.ini file.
2. Restart Apache.
3. upload the files in the attachment into the FA webroot - your index.php will get overwritten too. If you would like to manually patch the index.php, then make the following line the first executable one in your index.php file:

include_once("gettext.inc");

Now all standard language files in FA should display.

Ref: https://launchpad.net/php-gettext

***** This is not needed anymore - see later post. Just disable gettext extension in php.ini and php_gettext_support takes over.

Post's attachments

php-gettext.zip 9.7 kb, 22 downloads since 2015-10-28 

You don't have the permssions to download the attachments of this post.

Re: Change display language from English to another

Yes,

Sorry for the delayed response. Actually gettext is working. and no need to hook it again.  and my php is 5.6.3

and its windows 8 64x

the thing is its not working on the popular hosting server too.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Change display language from English to another

for Tamil Transalations i saw your language. but its not working fully. I mean the things you applied. but that brings few texts. not the whole thing.  say for example it retrieves translation for the pass word. but not working for the username.

like most of the things not working

Subscription service based on FA
HRM CRM POS batch Themes

10 (edited by apmuthu 11/04/2015 10:16:29 pm)

Re: Change display language from English to another

On your popular hosting server, make sure the locale for the language you need is installed in the operating system on the host box by your sysadmin first.

The Tamil language translation is only a partial one (just over 11%) since most Tamil people can understand username instead of it's more complex translated equivalent (transliterated) "Payanar Payir" - பயனர் பெயர். Anyway, this string is in the translation .mo file.

You can use it as a basis for filling in the full .po file and compiling the .mo file and using it.

Most languages supported in FA have fewer translations than Tamil in my repo. You can compute the % translation of any language by parsing the .po files obtained from the decompiled .mo files for translated strings instead of relying on the full .po files in the repo.

Wonder why it is not being included in the official repo (@joe: wink ?) !

Re: Change display language from English to another

Thank you very much for your help.

It work now for me

I just change the PHP.ini file (one line)

from
extension=php_gettext.dll
to
;extension=php_gettext.dll

12 (edited by apmuthu 11/04/2015 08:30:59 pm)

Re: Change display language from English to another

Hence gettext is compiled natively into the PHP in your XAMPP version.

When gettext is disabled in php.ini (especially needed in windows 5.3.0 to 5.3.5), php_gettext_support takes over and the .po files get parsed into .php files with same lang name containing the translated stings array.

The php_gettext library is not needed as it's functionality is already in the includes/lang/gettext.php file.

In this array based translation, some strings will not be present if the .po file has "\n" in the index of the string and it spans several lines. One such example in the .po file would be the string:

#: admin/backups.php:195
msgid ""
"You are about to restore database from backup file.\n"
"Do you want to continue?"
msgstr ""
"Zamierzasz odtworzyæ bazê danych z pliku.\n"
" Czy chcesz kontynuowaæ?"

It will get translated in the array if it is corrected to be:

#: admin/backups.php:195
msgid "You are about to restore database from backup file.\nDo you want to continue?"
msgstr "Zamierzasz odtworzyæ bazê danych z pliku.\n Czy chcesz kontynuowaæ?"