[Tickets #11139] Re: Cannot change Horde Language under Windows
bugs at horde.org
bugs at horde.org
Fri Apr 13 11:48:27 UTC 2012
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: http://bugs.horde.org/ticket/11139
------------------------------------------------------------------------------
Ticket | 11139
Updated By | almikhailov at parallels.com
Summary | Cannot change Horde Language under Windows
Queue | Horde Base
Version | 4.0.14
Type | Bug
State | Feedback
Priority | 2. Medium
Milestone |
Patch |
Owners |
------------------------------------------------------------------------------
almikhailov at parallels.com (2012-04-13 11:48) wrote:
> How? Not by us.
Old setLang() function in H3 works under Windows. Just check your code in
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;
// }
=========================
More information about the bugs
mailing list