Zen Cart Logo
Forums / Bug Reports / Using CUSTOM language file but defaulting some from ORIGINAL language file

Using CUSTOM language file but defaulting some from ORIGINAL language file

Views: 1,292

Results 1 to 3 of 3
11 Feb 2013, 12:17 PM
#1
servicesinfosl avatar

servicesinfosl

New Zenner

Join Date:
Feb 2012
Location:
Sherbrooke QC Canada
Posts:
8
Plugin Contributions:
0

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. :huh: 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!

11 Feb 2013, 4:04 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

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.

11 Feb 2013, 8:02 PM
#3
servicesinfosl avatar

servicesinfosl

New Zenner

Join Date:
Feb 2012
Location:
Sherbrooke QC Canada
Posts:
8
Plugin Contributions:
0

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!