Topic: Changing languages

I installed the es_CL language module on 2.0RC2 and all appears ok. I am logged in as admin. But, when I go to Preferences and select es_CL it indicates the preference changes but I still have English labels. If I log out and back in, Preferences shows English as my language again.

I can change other preferences (paper size, for example) and they change correctly.

Re: Changing languages

changing the language in preference only change the language during the session. But for the language to function permanently you must change it in the user setup as well.

I hope you get it to work.

Joe

Re: Changing languages

Well, I have some good news and some bad news. The good news is that I created a new user with Spanish as default and when I log in as them it says Spanish. The bad news is that it isn't Spanish.

But, that is something different to try to figure out. Let me see what more I can find.

Re: Changing languages

To use Spanish interface you should have installed spain messages package downloaded from frontaccounting.com. Also to use gettext some  changes could be necessary to web server configuration or system setup. For example when using gettext with apache under Linux one must have spanish locales installed.

To track some problems with FA setting $go_debug=1 in config.php can be useful. This variable switches warnings/errors display on.

5 (edited by yoshikawasaki 09/01/2008 12:52:01 am)

Re: Changing languages

Hi,

I've just install frontaccounting version 2.0 and have tried the method suggested above to install danish language but when I re-login, the display is still in English.

I have already installed danish locales, set the user preferences to danish, and have checked that gettext is installed. My installation is as follows.

1) Ubuntu Linux
2) PHP5
3) MySQL5

Could anyone help please?

And also just to check, do I need to change the default system locale to Danish if I wish to use display Danish language?

Re: Changing languages

Did you try the $go_debug set to 1, to eventually trap some errors here? Or did you try to look in the apache_error.log file at the server. Sometimes they report interesting things here.
Normally it should work right away.

/Joe

Re: Changing languages

I continue to be mystified as well. Running Kubuntu. No error messages. Things seem to change correctly (the user shows up as being in Spanish) but everything remains in English.

This is a "start over" effort with version 2.0 rather than a pre-release but I seem to be stuck at the same point.

Re: Changing languages

Are you sure that both the .mo and .po file is in the language folder on the server? The .po file is used by PHP to create a .php file, when gettext is not installed on the server.

/Joe

Re: Changing languages

I figure I must be missing something obvious.

Here is what is in /var/www/actg/lang/installed_languages.inc
$installed_languages = array (
        0 => array ('code' => 'en_GB', 'name' => 'English', 'encoding' => 'iso-8
859-1'),
                array ('code' => 'en_US', 'name' => 'English (US)', 'encoding' =
> 'iso-8859-1'),
                array ('code' => 'es_MX', 'name' => 'Spanish (MX)', 'encoding' =
> 'iso-8859-1'),
        );

Here is what an ls -lr from /var/www/actg/lang shows:
drwxrwxr-x 3 fyl      www-data 4096 Sep  1 17:13 new_language_template
-rwxrwxr-x 1 fyl      www-data  699 Sep  1 18:01 installed_languages.inc
-rwxrwxr-x 1 fyl      www-data   46 Mar 21  2007 index.php
drwxr-xr-x 3 www-data www-data 4096 Sep  1 18:01 es_MX
drwxrwxr-x 3 fyl      www-data 4096 Sep  1 17:13 en_US
fyl@paraguay:/var/www/actg/lang$ ls -lR
.:
total 20
drwxrwxr-x 3 fyl      www-data 4096 Sep  1 17:13 en_US
drwxr-xr-x 3 www-data www-data 4096 Sep  1 18:01 es_MX
-rwxrwxr-x 1 fyl      www-data   46 Mar 21  2007 index.php
-rwxrwxr-x 1 fyl      www-data  699 Sep  1 18:01 installed_languages.inc
drwxrwxr-x 3 fyl      www-data 4096 Sep  1 17:13 new_language_template

./en_US:
total 8
drwxrwxr-x 2 fyl www-data 4096 Sep  1 17:13 LC_MESSAGES
-rwxrwxr-x 1 fyl www-data  853 Jun  6 09:12 stylesheet.css

./en_US/LC_MESSAGES:
total 4
-rwxrwxr-x 1 fyl www-data 797 Apr 13 15:56 en_US.mo

./es_MX:
total 4
drwxr-xr-x 2 www-data www-data 4096 Sep  1 18:01 LC_MESSAGES

./es_MX/LC_MESSAGES:
total 548
-rw-r--r-- 1 www-data www-data 130652 Sep  1 18:01 es_MX.mo
-rw-r--r-- 1 www-data www-data 419946 Sep  1 18:01 es_MX.po

./new_language_template:
total 8
drwxrwxr-x 2 fyl www-data 4096 Sep  1 17:13 LC_MESSAGES
-rwxrwxr-x 1 fyl www-data  853 Jan 15  2004 stylesheet.css

./new_language_template/LC_MESSAGES:
total 524
-rwxrwxr-x 1 fyl www-data 531542 Apr  7 02:26 empty.po

No errors from debug or in the apache log.

Re: Changing languages

Try to give full privilegies on /es_MX/LC_MESSAGES folder (write enable). If gettext is not installed, then PHP will create a .php file to use for the language.

/Joe

Re: Changing languages

I tried. No change, no file created. I am sure there is something obvious here but I sure don't see it.

Re: Changing languages

The problem is the LC_MESSAGES folder is owned by fyl, not www-data, so server have no write access to it.
But if you have admin access to your server you can simply install gettext package. This is much better choice than fallback php solution. Otherwise try to set write permissions to 777 for the lang/es_MX/LC_MESSAGES folder.

Janusz

Re: Changing languages

Let's look at this again. Here is the current ls -lRa. Unless I am blind, everything in this tree is either owned by www-data and www-data has write permission or it is in group www-data and the www-data group has write permission.

drwxrwxr-x  5 fyl      www-data 4096 Sep  1 18:01 .
drwxrwxr-x 23 fyl      www-data 4096 Sep  1 18:19 ..
drwxrwxr-x  3 fyl      www-data 4096 Sep  1 17:13 en_US
drwxrwxr-x  3 www-data www-data 4096 Sep  1 18:01 es_MX
-rwxrwxr-x  1 fyl      www-data   46 Mar 21  2007 index.php
-rwxrwxr-x  1 fyl      www-data  699 Sep  1 18:01 installed_languages.inc
drwxrwxr-x  3 fyl      www-data 4096 Sep  1 17:13 new_language_template

./en_US:
total 16
drwxrwxr-x 3 fyl www-data 4096 Sep  1 17:13 .
drwxrwxr-x 5 fyl www-data 4096 Sep  1 18:01 ..
drwxrwxr-x 2 fyl www-data 4096 Sep  1 17:13 LC_MESSAGES
-rwxrwxr-x 1 fyl www-data  853 Jun  6 09:12 stylesheet.css

./en_US/LC_MESSAGES:
total 12
drwxrwxr-x 2 fyl www-data 4096 Sep  1 17:13 .
drwxrwxr-x 3 fyl www-data 4096 Sep  1 17:13 ..
-rwxrwxr-x 1 fyl www-data  797 Apr 13 15:56 en_US.mo

./es_MX:
total 12
drwxrwxr-x 3 www-data www-data 4096 Sep  1 18:01 .
drwxrwxr-x 5 fyl      www-data 4096 Sep  1 18:01 ..
drwxrwxrwx 2 www-data www-data 4096 Sep  1 18:01 LC_MESSAGES

./es_MX/LC_MESSAGES:
total 556
drwxrwxrwx 2 www-data www-data   4096 Sep  1 18:01 .
drwxrwxr-x 3 www-data www-data   4096 Sep  1 18:01 ..
-rw-r--r-- 1 www-data www-data 130652 Sep  1 18:01 es_MX.mo
-rw-r--r-- 1 www-data www-data 419946 Sep  1 18:01 es_MX.po

./new_language_template:
total 16
drwxrwxr-x 3 fyl www-data 4096 Sep  1 17:13 .
drwxrwxr-x 5 fyl www-data 4096 Sep  1 18:01 ..
drwxrwxr-x 2 fyl www-data 4096 Sep  1 17:13 LC_MESSAGES
-rwxrwxr-x 1 fyl www-data  853 Jan 15  2004 stylesheet.css

./new_language_template/LC_MESSAGES:
total 532
drwxrwxr-x 2 fyl www-data   4096 Sep  1 17:13 .
drwxrwxr-x 3 fyl www-data   4096 Sep  1 17:13 ..
-rwxrwxr-x 1 fyl www-data 531542 Apr  7 02:26 empty.po

So, that rules out a permission problem assuming apache is running as www-data in group www-data. From ps -g www-data or ps -u www-data, I get:
  PID TTY          TIME CMD
7276 ?        00:00:00 apache2
7277 ?        00:00:00 apache2
7278 ?        00:00:00 apache2
7279 ?        00:00:00 apache2
7280 ?        00:00:00 apache2
7281 ?        00:00:00 apache2
7282 ?        00:00:00 apache2
9013 ?        00:00:00 apache2
9014 ?        00:00:00 apache2
9015 ?        00:00:00 apache2

Is gettext installed?
  gettext is /usr/bin/gettext

from php5 -m, gettext is in the list. But, of course, that is shell php5. So, finally, from a phpinfo(); call, I get
    GetText Support   enabled

So, what am I missing/not checking?

Re: Changing languages

Yes, you are right, all seems right although if you have gettext installed, the write access is not needed as the php file is not created at all.

Have you locales-all package or simply locales for es_MX installed ? This is also required to use gettext.

Janusz

Re: Changing languages

Ok, I think we are getting close. I don't have the answer yet but my current guess is that the problem is that all the locales are UTF-8 and (I think) the es_MX file is iso-8559-1. If it isn't then I just guessed wrong when I uploaded it. In any case, I think I am on the right track. Can't do much until this evening as the computer is in use right now.

Re: Changing languages

Ok, I give. After finding nothing obvious on the local Kubuntu setup I decided to listall on shared hosting at site5 where I run lots of other stuff. Everything seems to have installed fine. I added the es_MX.mo and es_MX.po files through the GUI. No errors. Created a new user with Spanish as their default. When I log on as that user it says they are in Spanish but everything is still English. I haven't done a thorough permissions search--just looked in the apache log and find no errors. As it works just like it did on Kubuntu, um, clearly I just need a lobotomy.

Re: Changing languages

What about the locales ? I've checked it on my installation, that without proper locales installed the gettext simply fails silently. For example I use pl_PL messages with no probnlem, but when I copy lang/pl_PL file to e.g. lang/xx_XX and make respective addition in installed_languages.php the xx_XX language doesn't work. Locales are defined in debian together with encoding e.g. pl_PL.ISO-8859-2 or es_MX.ISO-8859-1. Then if you declare improper encoding the gettext can also fail. You can list all installed locales with
    locale -a
Then compare it with your FA settings.

Janusz

Re: Changing languages

Actually, you got it. I had thought about this realizing that es_MX is iso-8859-1 but all the locales are UTF-8. But, I then mistakenly wrote this off as English was working. But, English doesn't need a locale/gettext.

So, if I convert es_MX to UTF-8, all should be well.

Re: Changing languages

BTW, it didn't work/solve the problem. I am going to take "an intellectual vacation".

Re: Changing languages

Keep in mind that it is not enough to recode messages .po /.mo to utf-8. You should also declare proper encoding in installed_languages.php. If all three encodings are utf-8 (system locale, messages.mo and installed_languages.php entry) I have no more idea on that issue.

Janusz

Re: Changing languages

Hi, I've just finished the dutch translation and posted a message about it on the language-topic.

However, I think I have the same problem as user nicafyl. The translation works fine on my local PC (USBWebserver) but not on 2 different hosted websites - one with PHP 4 and one with PHP 5.

I think there is a php-parameter that prevents the translation....  Anyone knows how to tackle this problem ?

Re: Changing languages

The translation system works on both php4 and php5 as the whole FA. First you should check if the affected systems does use gettext extension. If not emulated gettext is used and you should check write permissions to subdirectories described above. On the other hand FA does not use write access and you should check if your system have proper locale installed.
According to php manual there is no php settings related to gettext in php.
Janusz

23 (edited by MorkvonOrk 09/18/2008 09:46:37 pm)

Re: Changing languages

On both hosted systems, where the translation of FA does not work, gettext is enabled. At least that's what I see in phpinfo().

How does one check which locales are installed on a system?

On both systems the multilanguage function of phpMyAdmin works fine.