Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2012
    Location
    Sherbrooke QC Canada
    Posts
    6
    Plugin Contributions
    0

    Default Using CUSTOM language file but defaulting some from ORIGINAL language file

    Hello. I have set up and running 2 Zen Cart stores and ran into a strange problem.

    I used "@setlocale(LC_TIME, 'fr_CA.utf8');" in my CUSTOM french.php file located under "languages/custom" folder. My month names that had accents would appear with accents replaced with a black "?" symbol (ie: f?vrier instead of février).

    After many hours of debugging, it turned out that Zen Cart seamed to pull @setlocale(LC_TIME,'fr_FR.ISO_8859-1'); from my ORIGINAL french.php located in languages folder. But the rest of my configuration from my custom folder.

    Simply setting "@setlocale(LC_TIME, 'fr_CA.utf8');" in my ORIGINAL file in languages folder corrected the problem.

    We are not supposed to modifying a core file like that from what I read. Anyone know why Zen Cart is pulling only that setting from the original core file instead of from my custom file?

    Thanks!

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

    Default Re: Using CUSTOM language file but defaulting some from ORIGINAL language file

    I suspect you've put your file in the wrong place, or put excess content into it, or used the wrong encoding.

    Language files need to be saved with "UTF8-without-BOM" encoding format. Your text editor will have a setting for that.

    Non-Admin language files should be stored at:
    /includes/languages/english.php
    /includes/languages/french.php
    /includes/languages/YOUR_TEMPLATE_NAME_HERE/english.php
    /includes/languages/YOUR_TEMPLATE_NAME_HERE/french.php

    Productivity tip: the /includes/languages/YOUR_TEMPLATE_NAME_HERE/french.php file only needs the things you've changed from the /includes/languages/french.php file. It doesn't need a complete copy of everything in the /includes/languages/french.php file.

    Yes, it DOES load both files. But it always loads the one in YOUR_TEMPLATE_NAME_GOES_HERE folder first, and then loads the master (and skips anything already defined from the first file since "define"s cannot be re-"define"-d). This is to allow for backward-compatibility for people who apply outdated language packs on new ZC versions without adding the new translations to their override files.
    .

    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.

  3. #3
    Join Date
    Feb 2012
    Location
    Sherbrooke QC Canada
    Posts
    6
    Plugin Contributions
    0

    Default Re: Using CUSTOM language file but defaulting some from ORIGINAL language file

    Excellent explanation. I didn't know about including only things that are different in our custom file.

    As for the location of the file, I am sure they are in the right areas. However, if the file may have excess in it, absolutely!

    I will do more testing and report if everything is in order. Thanks!

 

 

Similar Threads

  1. List constants from a specific language file?
    By torvista in forum General Questions
    Replies: 3
    Last Post: 8 Jul 2011, 08:15 PM
  2. Custom Template confusion - language file
    By richard.rodriguez in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 30 Mar 2011, 11:15 PM
  3. Editing text in template file instead of language file
    By cochlear in forum General Questions
    Replies: 2
    Last Post: 4 Jun 2008, 01:47 AM
  4. using the character ë in a language file
    By capanno in forum General Questions
    Replies: 7
    Last Post: 15 May 2008, 10:21 AM

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