6.0.0-beta1
7/6/25

[#11139] Cannot change Horde Language under Windows
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

History
06/01/2012 04:45:51 PM Jan Schneider State ⇒ No Feedback
 
04/13/2012 12:31:15 PM Jan Schneider Comment #4 Reply to this comment
This only means that Windows, or at least your Windows, doesn't 
support UTF-8 locales. Support for those is required for Horde 4, and 
we don't support any systems that lack it.
04/13/2012 11:48:27 AM almikhailov (at) parallels (dot) com Comment #3 Reply to this comment
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;
//        }
  =========================
04/12/2012 09:55:31 AM Jan Schneider Comment #2
Priority ⇒ 2. Medium
State ⇒ Feedback
Reply to this comment
There was not such problem in H3. It was workarounded.
How? Not by us.
04/10/2012 08:20:31 AM almikhailov (at) parallels (dot) com Comment #1
Priority ⇒ 3. High
Type ⇒ Bug
Summary ⇒ Cannot change Horde Language under Windows
Due ⇒ 04/10/2012
Queue ⇒ Horde Base
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
PROBLEM DESCRIPTION

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.

Saved Queries