Topic: Default C Language errors

When no language is chosen for the FA user interface, the fallback language is "C".

Older PHP versions did not have native gettext support or it was not compiled into it or it was not enabled in the php.ini.

For such instances, the fallback was a language translation array that was generated if the <locale>.php file was not compiled after the corresponding .po file.

If the lang/new_language_template/C.php, then it would throw up errors in the tmp/errors.log file.

To mitigate this, in the includes/lang/gettext.inc file, after:

    function _load_domain($domain, $path = "./locale")
    {
        $src_domain = $path . "/$this->_lang_code/LC_MESSAGES/$domain.po";
        $php_domain = $path . "/$this->_lang_code/LC_MESSAGES/$domain.php";

insert the following:

        if ( $this->_lang_code == 'C' ) {
            $src_domain = $path . "/new_language_template/LC_MESSAGES/empty.po";
            $php_domain = $path . "/new_language_template/LC_MESSAGES/C.php";
        }

and create the file lang/new_language_template/C.php with the following contents:

<?php
return array();

This fix is available in my FA24Mods commit.

Post's attachments

FA_C_Lang_Fix.png 16 kb, file has never been downloaded. 

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

Re: Default C Language errors

Apparently my installation got messed up a bit by this. I discovered that the default language in lang/installed_languages.inc was "C", but the lang folder didn't have a "C" folder, but rather an "en_US" folder. I edited the installed_languages.inc file to use 'en_US', but I still had a problem, because the file in lang/en_US/LC_MESSAGES was named "en_US.mo", rather than "en_US.po". After renaming it, the errors stopped.

That is now fixed, but that's not the problem I had set out to find. sad

Re: Default C Language errors

The file en_US.mo should not be renamed to .po. Instead remove the entire en_US folder if you want or just add in the en_US.po file for your records by either generating it from the .mo file or copying it over from here (ISO-8859-1) or from here here (UTF-8).

Re: Default C Language errors

Ok. Thanks. I'm not sure how the language translation would work with the installed_languages.inc file pointing to a non-existent folder. The error log was getting appended constantly. I just installed the en_US.po file you linked. I still have a month to get all of this working correctly. I am making progress, but I still have more questions.

Re: Default C Language errors

Are you working a Windows platform? If so, you may have to disable gettext in your php.ini and you will then get array based translation.

Re: Default C Language errors

I'm using a CentOS7 server with PHP 5.6.23 and MySQL version 5.7.15.
I think I'm missing zLib because I don't get any installed/available extensions, languages, etc. on the setup page. I haven't figured out how to add zLib to PHP using Yum. I'm not in a hurry to compile a custom version of PHP because I prefer to use Yum to keep the system updated.

Re: Default C Language errors

Keeping your MySQL version to be <= 5.5 will avoid needing to enable date strict mode to allow for zero dates and times to be acceptable.

zLib compression - HowTo.

Re: Default C Language errors

Thanks. I'm not sure I'm ready to downgrade MySQL, as I'm using it for several projects. The server I'm going to install this on for my client is running server version: 5.5.56-MariaDB.

I am using my installation for my business (so I can learn FrontAccounting and do real-world testing), and so far everything has been working for me ... except the install/activate extensions stuff, which I am not sure I need for my small software development/consulting business.

Re: Default C Language errors

I realized, after testing on my client's server (also CentOS 7), that I had compiled my own PHP module for another issue I had, and I had not compiled in zlib support, so I recompiled and everything is working. Sorry for wasting your time with that.

Re: Default C Language errors

@oakstreet1: Thanks for the feedback as it will avoid sidetracking users especially newbies.