Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,547
    Plugin Contributions
    89

    Default Setting locale in template-override directory

    I have a multi-lingual site (English and Spanish) and I noticed yesterday that zen_date_long was formatting Saturdays like s�bado, even though my /includes/languages/MY_TEMPLATE/spanish.php had the statement
    Code:
    @setlocale(LC_TIME, 'es_ES.UTF-8');
    After much hair-pulling and a helpful link (http://www.zen-cart.com/showthread.p...l-server-maybe) from torvista, I finally figured out what the heck was going on.

    I'd upgraded this site from ZC 1.3.9h and converted to UTF-8 in the process. Although my template-override version of spanish.php was setting the locale for UTF-8, my base (i.e. /includes/languages/spanish.php) language file was still setting the locale to the non-UTF-8 format! Since it's a function call instead of a define, the last file loaded (base) "won".

    I'm just mentioning this here to save others a fair amount of time and to note that the issue could be rectified by wrapping the call to setlocale with a "define" so that the function will only be run once, e.g.
    Code:
    if (!defined('ZEN_SETLOCALE_RUN')) {
      define('ZEN_SETLOCALE_RUN', true);
      @setlocale(LC_ALL, 'en_EN.UTF-8);
    }

  2. #2
    Join Date
    Jan 2004
    Posts
    66,378
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Setting locale in template-override directory

    This will be mitigated in 1.6.0 where the locale-specific stuff is split off from the english.php into its own separate locale.php file, for this and numerous other reasons.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. where is my template-override-directory?
    By Interdigital_Designs in forum General Questions
    Replies: 1
    Last Post: 10 Jul 2011, 03:32 AM
  2. Images Directory Override
    By Randa in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 8 Sep 2010, 07:51 PM
  3. Override Directory for /includes Root ?
    By dmm2020 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 15 Mar 2009, 05:01 PM
  4. override directory tree batch
    By TecBrat in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 9 Jun 2008, 02:11 PM
  5. Define Pages Editor or Override Directory?
    By mlm2005 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 4 Jul 2006, 03:51 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