Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,557
    Plugin Contributions
    28

    Default Default language for admin different than shop

    My client's site is set for Swedish as the default language. Is it possible to set the admin to default to English?

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Default language for admin different than shop

    Just do not use the admin Swedish language files
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,557
    Plugin Contributions
    28

    Default Re: Default language for admin different than shop

    That was the first thing I tried. When I deleted the Swedish admin language files, I got this error:

    [08-Jul-2014 16:47:33 America/Chicago] PHP Warning: require(includes/languages/swedish.php): failed to open stream: No such file or directory in /home/miashop/public_html/zencart/XXXXXX/includes/init_includes/init_languages.php on line 35

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Default language for admin different than shop

    admin > localization > Languages > set english to be default(might be sort order)
    Zen-Venom Get Bitten

  5. #5
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,557
    Plugin Contributions
    28

    Default Re: Default language for admin different than shop

    English has a sort order of zero, Swedish is one and is the default. If I set English as the default, that changes the store front the English as well.

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

    Default Re: Default language for admin different than shop

    You could make a small core file change to /YOUR_ADMIN/includes/init_includes/init_languages.php:
    Code:
    <?php
    /**
     * @package admin
     * @copyright Copyright 2003-2012 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version GIT: $Id: Author: DrByte  Fri Jul 6 11:57:44 2012 -0400 Modified in v1.5.1 $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    if (!defined ('DEFAULT_LANGUAGE_ADMIN')) define ('DEFAULT_LANGUAGE_ADMIN', 1);  //-Default admin to English
    // set the language
      if (!isset($_SESSION['language']) || isset($_GET['language'])) {
    
        include(DIR_WS_CLASSES . 'language.php');
        $lng = new language();
    
        if (isset($_GET['language']) && zen_not_null($_GET['language'])) {
          $lng->set_language($_GET['language']);
        } else {
          $lng->get_browser_language();
          $lng->set_language(DEFAULT_LANGUAGE_ADMIN);
        }
    
        $_SESSION['language'] = (zen_not_null($lng->language['directory']) ? $lng->language['directory'] : 'english');
        $_SESSION['languages_id'] = (zen_not_null($lng->language['id']) ? $lng->language['id'] : 1);
        $_SESSION['languages_code'] = (zen_not_null($lng->language['code']) ? $lng->language['code'] : 'en');
      }
    
    // temporary patch for lang override chicken/egg quirk
      $template_query = $db->Execute("select template_dir from " . TABLE_TEMPLATE_SELECT . " where template_language in (" . (int)$_SESSION['languages_id'] . ', 0' . ") order by template_language DESC");
      $template_dir = $template_query->fields['template_dir'];
    
    // include the language translations
      require(DIR_WS_LANGUAGES . $_SESSION['language'] . '.php');
      $current_page = basename($PHP_SELF);
      if (file_exists(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . $current_page)) {
        include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . $current_page);
      }
    
      if ($za_dir = @dir(DIR_WS_LANGUAGES . $_SESSION['language'] . '/extra_definitions')) {
        while ($zv_file = $za_dir->read()) {
          if (preg_match('~^[^\._].*\.php$~i', $zv_file) > 0) {
            require(DIR_WS_LANGUAGES . $_SESSION['language'] . '/extra_definitions/' . $zv_file);
          }
        }
        $za_dir->close();
      }

  7. #7
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,557
    Plugin Contributions
    28

    Default Re: Default language for admin different than shop

    Editing the core file was Plan B, if there was not a setting to use first.

    I used your edit, changing ('DEFAULT_LANGUAGE_ADMIN', 1) to ('DEFAULT_LANGUAGE_ADMIN', 0) since English is o and Swedish is 1, but when I log in I'm still getting Swedish as the default in the admin. I also tested in FF, Chrome is my default) and got the same result.

    I don't see DEFAULT_LANGUAGE_ADMIN defined any where.

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

    Default Re: Default language for admin different than shop

    Duh! Make this change:
    Code:
    if (!defined ('DEFAULT_LANGUAGE_ADMIN')) define ('DEFAULT_LANGUAGE_ADMIN', 'en');  //-Default admin to English
    If you're currently logged into your admin, you'll need to logout first to have the change take effect.

    P.S. DEFAULT_LANGUAGE_ADMIN is not a currently defined within the Zen Cart codebase.

  9. #9
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,557
    Plugin Contributions
    28

    Default Re: Default language for admin different than shop

    I love simple fixes! That was it, thanks.

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

    Default Re: Default language for admin different than shop

    Most excellent! I'm glad it (finally) worked.

 

 

Similar Threads

  1. Display, checkout with different currency than default
    By jami1955 in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 1
    Last Post: 28 Oct 2010, 10:46 AM
  2. Replies: 3
    Last Post: 18 Jul 2009, 04:54 PM
  3. Fatal Error with other than default language
    By ellivir in forum General Questions
    Replies: 12
    Last Post: 3 Apr 2009, 10:01 PM
  4. Replies: 4
    Last Post: 11 May 2008, 11:25 AM
  5. How to set a default country per language for multi language sites
    By lacabessa in forum Addon Language Packs
    Replies: 2
    Last Post: 18 Nov 2006, 11:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR