Summary | Cannot change Horde Language under Windows |
Queue | Horde Base |
Queue Version | 4.0.14 |
Type | Bug |
State | No Feedback |
Priority | 2. Medium |
Owners | |
Requester | almikhailov (at) parallels (dot) com |
Created | 04/10/2012 (4835 days ago) |
Due | |
Updated | 06/01/2012 (4783 days ago) |
Assigned | 04/12/2012 (4833 days ago) |
Resolved | 06/01/2012 (4783 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
support UTF-8 locales. Support for those is required for Horde 4, and
we don't support any systems that lack it.
horde\lib\Horde\nls.php:
=========================
/**
* Sets the language.
*
* @param string $lang The language abbreviation.
*/
function setLang($lang = null)
{
Horde::loadConfiguration('nls.php', null, 'horde');
if (empty($lang) || !NLS::isValid($lang)) {
$lang = NLS::select();
}
$_SESSION['horde_language'] = $lang;
if (isset($GLOBALS['language'])) {
if ($GLOBALS['language'] == $lang) {
return;
} else {
$GLOBALS['registry']->clearCache();
}
}
$GLOBALS['language'] = $lang;
/* First try language with the current charset. */
$lang_charset = $lang . '.' . NLS::getCharset();
if ($lang_charset != setlocale(LC_ALL, $lang_charset)) {
/* Next try language with its default charset. */
global $nls;
$charset = !empty($nls['charsets'][$lang]) ?
$nls['charsets'][$lang] : 'ISO-8859-1';
$lang_charset = $lang . '.' . $charset;
NLS::_cachedCharset(0, $charset);
if ($lang_charset != setlocale(LC_ALL, $lang_charset)) {
/* At last try language solely. */
$lang_charset = $lang;
setlocale(LC_ALL, $lang_charset);
}
}
@putenv('LC_ALL=' . $lang_charset);
@putenv('LANG=' . $lang_charset);
@putenv('LANGUAGE=' . $lang_charset);
}
=========================
BTW, if you just commen several lines in H4 implementation it starts
to work under Windows too:
=========================
public function setLanguage($lang = null)
{
...
// if (setlocale(LC_ALL, $lang_charset)) { // <<<--- returns
'false' under Windows
putenv('LC_ALL=' . $lang_charset);
putenv('LANG=' . $lang_charset);
putenv('LANGUAGE=' . $lang_charset);
// } else {
// $changed = false;
// }
=========================
Priority ⇒ 2. Medium
State ⇒ Feedback
Priority ⇒ 3. High
Type ⇒ Bug
Summary ⇒ Cannot change Horde Language under Windows
Due ⇒ 04/10/2012
Queue ⇒ Horde Base
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Changing of Language on Horde Login page does not work under Windows.
ROOT CAUSE
PEAR\Horde\registry.php:
=====================
public function setLanguage($lang = null)
{
...
if (setlocale(LC_ALL, $lang_charset)) { // <<<--- returns
'false' under Windows
putenv('LC_ALL=' . $lang_charset);
putenv('LANG=' . $lang_charset);
putenv('LANGUAGE=' . $lang_charset);
} else {
$changed = false;
}
...
=====================
OS-depended setlocale() function is used:
http://www.php.net/manual/en/function.setlocale.php
=====================
Tip
Windows users will find useful information about locale strings at
Microsoft's MSDN website. Supported language strings can be found at »
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_language_strings.asp and supported country/region strings at »
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_country_strings.asp.
=====================
ADDITIONAL INFORMATION
There was not such problem in H3. It was workarounded.