Althoug the mo files are generated via build.sh, and the main options menu items are translated, in wvry plugin options page, language is resetted to English
The main options page is corretcly translated, but every postfixadmin page isn't
correctly translated options page
I can reproduce this bug in FreeBSD 9.1-RELEASE using the latest ports; squirrelmail 1.4.22 and squirrelmail-postfixadmin-plugin (2.3.0).
The steps to reproduce are:
1. Set your browser's preffered language to en_US.
2. Set the default squirrelmail language to something other than en_US and make sure it's supported by both squirrelmail and the postfix squirrelmail-plugin.
3. Open squirrelmail and look at the main options menu, try to set up forwarding/vacation/password. Compare with the screenshots.
Technical conclusions (I'm a php noob, please bear with me):
This is a problem with dependencies and scope in the function include_if_exists() in functions.inc.php that is being called around line 13 in common.php with the parameter "SM_PATH . 'include/validate.php'".
Validate.php depends on "SM_PATH . 'functions/i18n.php'", which has an undocumented dependency on the global variable $squirrelmail_default_language (declared in "SM_PATH . 'config/config.php' ) inside the set_up_language() function. This variable is not in the scope of include_if_exists(), which will cause it to appear as empty when set_up_language() is called.
When set_up_language() doesn't see the default language, it will try to get the preferred language from the HTTP_ACCEPT_LANGUAGE header instead. That is fine and explained in the squirrelmail documentation. However, our browser is set to en_US and squirrelmail is set to something different, hence we get this bug.
NOTE: In the plugin's common.php, there's a conditional statement after the call to include_if_exists(), which will make no difference, due to the static variable $Setup_Already, declared in set_up_language().
How to fix:
In common.php, uncomment the line that calls include_if_exists(). The conditional statement which follows it will make sure that validate.php is included in the global scope.
To make things as clear as possible, here's some diff output. Common.php.old is identical to the latest common.php.
--- common.php.old 2013-01-14 03:02:33.000000000 +0100
+++ common.php.new 2013-01-14 03:01:52.000000000 +0100
@@ -10,7 +10,7 @@
include_once(SM_PATH . 'plugins/postfixadmin/config.php');
include_once(SM_PATH . 'plugins/postfixadmin/functions.inc.php');
-include_if_exists(SM_PATH . 'include/validate.php');
+//include_if_exists(SM_PATH . 'include/validate.php');
if (file_exists(SM_PATH . 'include/validate.php'))
include_once(SM_PATH . 'include/validate.php');
I of course meant to say "In common.php, comment out the line that calls include_if_exists()".