Zen Cart Logo
Forums / Addon Language Packs / French translation and special characters

French translation and special characters

Views: 13,410

Results 1 to 20 of 24
9 Aug 2010, 1:58 PM
#1
jatt avatar

jatt

New Zenner

Join Date:
Jul 2010
Posts:
26
Plugin Contributions:
0

French translation and special characters

I installed the French add-on on my zen-cart.

However, the special characters are changed for some weird code...

à for à
é for é
ô for ô
è for è
etc...

That's fine for the web site as the code is changed for the real character.

However in the emails sent to the French customers, the code is shown instead of the character.

Here is an example:
Nous vous remercions de votre confiance !
Voici les détails de votre commande.

Numéro de commande : 1
Date de commande : vendredi 06 août 2010 Facture détaillée :

How can I change that so the emails look good and are readable.

9 Aug 2010, 2:47 PM
#2
jatt avatar

jatt

New Zenner

Join Date:
Jul 2010
Posts:
26
Plugin Contributions:
0

Re: French translation and special characters

I tried to find a solution on my own and I'm stuck...

I tried the solution suggested in another post, saying to create a my_db_charset.php file in the extra_configures folders (catalog/include and admin/include)
didn't do it.

I changed the create_account.php file in the catalog/includes/languages/french folder and replaced the following word:
détails for détails

Before the change, the email showed: détails both in text and html
After the change, the email shows: détails both in text and html.
What can I do to make it show détails so the customer receives a readable welcoming email

22 Jun 2011, 12:55 PM
#3
ink avatar

ink

Zen Follower

Join Date:
Jul 2004
Posts:
140
Plugin Contributions:
0

Re: French translation and special characters

Kind people Dr Byte / Ajeh is there a solution to this? We too have the same problem, the store/database is set to UTF-8, or are we missing something simple?

19 Oct 2011, 5:42 AM
#5
mehamgul101 avatar

mehamgul101

New Zenner

Join Date:
Oct 2011
Posts:
2
Plugin Contributions:
0

Re: French translation and special characters

well maybe you can find the soloution by sending them an email to the help centre if it is still creat problem for you
then definitely they will solve your french translation problem or go to the link as the above user has provided ........

8 Nov 2012, 6:05 PM
#6
abcisme avatar

abcisme

Zen Follower

Join Date:
Jun 2006
Posts:
298
Plugin Contributions:
0

Re: French translation and special characters

Still searching for a solution to this issue. My French language characters are showing up as é etc. in my text emails. If I put the actual "é" nothing shows in the text email.

I searched the developers toolkit for iso-8859-1 and changed everything to utf-8. I can't figure out how to make this work. Extremely frustrating.

If anyone has found a way to make this work, please be so kind as to let us all know! Thanks!

8 Nov 2012, 6:22 PM
#7
abcisme avatar

abcisme

Zen Follower

Join Date:
Jun 2006
Posts:
298
Plugin Contributions:
0

Re: French translation and special characters

Very close to figuring this out, but not 100%.

In includes / functions / functions_email.php

Find:

/ / Fix slashes 
$text = stripslashes ($email_text); 

Replace with:

      // fix slashes
      $text = stripslashes (utf8_encode(html_entity_decode($email_text)));

The only problem now is that the accents in the order status and the order status comments have iso-8859-1 codes showing up.

For example:

Commentaires :
Annulé
L'état de votre commande a été mis à jour : Annulé

Not sure where to go about mending that....

14 Nov 2012, 5:36 PM
#8
abcisme avatar

abcisme

Zen Follower

Join Date:
Jun 2006
Posts:
298
Plugin Contributions:
0

Re: French translation and special characters

Ok, I realize this is NOT the right way to go about fixing it, but here's what I did to make the text emails work right until someone comes up with the correct solution:

Find:

/ / Fix slashes 
$text = stripslashes ($email_text);

Replace with:

      // fix slashes
      $text = stripslashes (utf8_encode(html_entity_decode($email_text)));

Find:

     // fix double quotes
      while (strstr($email_text, '"')) $email_text = str_replace('"', '"', $email_text);

Add after:

	  //fix special french characters
while (strstr($email_text, 'À')) $email_text = str_replace('À', 'À', $email_text);
while (strstr($email_text, 'â')) $email_text = str_replace('â', 'â', $email_text);
while (strstr($email_text, 'Â')) $email_text = str_replace('Â', 'Â', $email_text);
while (strstr($email_text, 'ä')) $email_text = str_replace('ä', 'ä', $email_text);
while (strstr($email_text, 'Ä')) $email_text = str_replace('Ä', 'Ä', $email_text);
while (strstr($email_text, 'æ')) $email_text = str_replace('æ', 'æ', $email_text);
while (strstr($email_text, 'Æ')) $email_text = str_replace('Æ', 'Æ', $email_text);
while (strstr($email_text, 'ç')) $email_text = str_replace('ç', 'ç', $email_text);
while (strstr($email_text, 'Ç')) $email_text = str_replace('Ç', 'Ç', $email_text);
while (strstr($email_text, 'é')) $email_text = str_replace('é', 'é', $email_text);
while (strstr($email_text, 'É')) $email_text = str_replace('É', 'É', $email_text);
while (strstr($email_text, 'è')) $email_text = str_replace('è', 'è', $email_text);
while (strstr($email_text, 'È')) $email_text = str_replace('È', 'È', $email_text);
while (strstr($email_text, 'ê')) $email_text = str_replace('ê', 'ê', $email_text);
while (strstr($email_text, 'Ê')) $email_text = str_replace('Ê', 'Ê', $email_text);
while (strstr($email_text, 'ë')) $email_text = str_replace('ë', 'ë', $email_text);
while (strstr($email_text, 'Ë')) $email_text = str_replace('Ë', 'Ë', $email_text);
while (strstr($email_text, 'î')) $email_text = str_replace('î', 'î', $email_text);
while (strstr($email_text, 'ÃŽ')) $email_text = str_replace('ÃŽ', 'Î', $email_text);
while (strstr($email_text, 'ï')) $email_text = str_replace('ï', 'ï', $email_text);
while (strstr($email_text, 'Ï ')) $email_text = str_replace('Ϗ ', 'Ï', $email_text);
while (strstr($email_text, 'ô')) $email_text = str_replace('ô', 'ô', $email_text);
while (strstr($email_text, 'Ô')) $email_text = str_replace('Ô', 'Ô', $email_text);
while (strstr($email_text, 'ù')) $email_text = str_replace('ù', 'ù', $email_text);
while (strstr($email_text, 'Ù')) $email_text = str_replace('Ù', 'Ù', $email_text);
while (strstr($email_text, 'û')) $email_text = str_replace('û', 'û', $email_text);
while (strstr($email_text, 'Û')) $email_text = str_replace('Û', 'Û', $email_text);
while (strstr($email_text, 'ü')) $email_text = str_replace('ü', 'ü', $email_text);
while (strstr($email_text, 'Ü')) $email_text = str_replace('Ü', 'Ü', $email_text);
while (strstr($email_text, '«')) $email_text = str_replace('«', '«', $email_text);
while (strstr($email_text, '»')) $email_text = str_replace('»', '»', $email_text);
while (strstr($email_text, 'Ã')) $email_text = str_replace('Ã', 'à', $email_text);
 
14 Nov 2012, 10:25 PM
#9
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,871
Plugin Contributions:
7

Re: French translation and special characters

You are making matters worse trying to fix something that is not broken.

The need for correct accents everywhere is the same in spanish: install a fresh zen cart 1.51 and the corresponding spanish language pack. Check that it works fine, then add the french one, see if it works. Compare them to see what is going wrong.

15 Nov 2012, 12:41 AM
#10
abcisme avatar

abcisme

Zen Follower

Join Date:
Jun 2006
Posts:
298
Plugin Contributions:
0

Re: French translation and special characters

I'm using 1.3.9h and have a ton of mods. There's no way I can do a fresh install and start over.

This is not something that is just my installation. It's documented on Zen Cart France also: http://www.zencart-france.com/forum/probleme-sur-email-t3455.0.html

I'm sure it has something to do with the fact that the French language pack was in ISO-8859-1, which I switched to UTF-8.

Like I said, I know what I did was not the right way to fix it, but it is working for now. So until I can figure out what the proper solution is, that's going to have to be the bandaid. :(

midivin:

One solution is to use 2 differents datas in the language definition file (one for email, one for the site).

I think this would work, if I knew how to do it. If I could set the email charset to iso-8859-1 and the site email to utf-8, then I could just use html_entity_decode to decode the text email....? Maybe?

15 Nov 2012, 12:01 PM
#11
abcisme avatar

abcisme

Zen Follower

Join Date:
Jun 2006
Posts:
298
Plugin Contributions:
0

Re: French translation and special characters

abcisme:

I think this would work, if I knew how to do it. If I could set the email charset to iso-8859-1 and the site email to utf-8, then I could just use html_entity_decode to decode the text email....? Maybe?

This should have read "If I could set the email charset to iso-8859-1 and the site charset to utf-8"...

15 Nov 2012, 12:37 PM
#12
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,871
Plugin Contributions:
7

Re: French translation and special characters

There's no way I can do a fresh install and start over.
I'm not suggesting you do that, I'm suggesting you use a fresh install, with no mods or hacked code to find out whats wrong with the french fileset.
I'll have a look at it over the weekend.

15 Nov 2012, 12:50 PM
#13
abcisme avatar

abcisme

Zen Follower

Join Date:
Jun 2006
Posts:
298
Plugin Contributions:
0

Re: French translation and special characters

Ok, thanks for clarifying. Here's the problem. My database is in utf-8. english.php is in utf-8. The French language pack is in iso-8859-1. In order to get the site to work, I had to change the charset in the french.php file to utf-8. But in doing so, the text emails no longer display special characters. If I switch the french.php charset back to iso-8859-1, the email works, but the site is unreadable.

I've tried iconv, html_entity_decode/encode, utf_decode/encode, htmlspecialchars_decode, htmlentities, htmlspecialchars... I tried re-saving my french files in utf-8 w/o BOM and iso-8859-1. I tried inputting the special characters directly in the define text, instead of the é codes.

Just trying to figure out a way to get the email text to convert to utf-8, but the only thing that has worked sufficiently is what I posted above. And I know it's not the right answer, but I just needed to get it to work until I can figure out what the right answer is.

Thanks so much for any help you can provide. I really appreciate it.

16 Nov 2012, 9:02 PM
#14
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,871
Plugin Contributions:
7

Re: French translation and special characters

The problem with the French language pack is that all the accents have been written as html entities in the files when they should be written as characters.
So, in a new ZC151 install, I added the current 1.39 french fileset, and revised only the french.php for admin and catalog, (including adding and deleting the new and old constants, which would not matter in this test case).

So for utf-8, make sure these locale items are as shown below.

(NOTE that the french files have mods to change the dob to dd/mm/yyyy which are incidentally partially shown here, and so do not reflect the vanilla english (us) default mm//dd//yyyy.)

admin, french.php

define('HEADER_LOGO_IMAGE', 'logo.gif');
setlocale(LC_TIME, 'French_France.1252');//add for windows
// look in your $PATH_LOCALE/locale directory for available locales..
setlocale(LC_TIME, 'fr_FR.UTF8');//unix
define('DATE_FORMAT_SHORT', '%d/%m/%Y');  // this is used for strftime()

// charset for web pages and emails
define('CHARSET', 'utf-8');


catalog, french.php

3) ```php
define('FOOTER_TEXT_BODY', 'Copyright © ' . date('Y') . ' <a href="' . zen_href_link(FILENAME_DEFAULT) . '" target="_blank">' . STORE_NAME . '</a>. Powered by <a href="http://www.zen-cart.com" target="_blank">Zen Cart</a>. Traduction par <a href="http://www.zencart-france.com" target="_blank">Zen Cart France</a>.');
setlocale(LC_TIME, 'French_France.1252');//add for windows
// look in your $PATH_LOCALE/locale directory for available locales..
  @setlocale(LC_TIME, 'fr_FR.UTF8');
  define('DATE_FORMAT_SHORT', '%d/%m/%Y');  // this is used for strftime()

// charset for web pages and emails
define('CHARSET', 'utf-8');


5)  In ZC 1.5+ the default charset for database data transfer is already set as utf-8 in the configure.php files.

  ```php
define('DB_CHARSET', 'utf8');

In 1.39 you had to create this define somewhere, in both admin and catalog (you could add it in the configure.php s like ZC1.5).

So, when an order is placed, the confirmation email arrives like this

Voici les détails de votre commande.

Why? Because that is exactly what is written in the language file!
Change the htmlentity to a character and so does the email.

Voici les détails de votre commande.

So, now someone has to write a script to batch convert all those htmlentities in all the files to normal characters, and them someone has to update all the files to match the ZC1.51 english version.
Hours of fun for all the family.

I hope this is the last new thread I see about utf-8, there is more than enough info in this forum and the web to explain what is happening with character encoding and how to fix it.

16 Nov 2012, 9:05 PM
#15
abcisme avatar

abcisme

Zen Follower

Join Date:
Jun 2006
Posts:
298
Plugin Contributions:
0

Re: French translation and special characters

I have tried converting the é to é and get no character at all.

Both my french.php in admin and catalog are set exactly as you've shown.

This is why I am so frustrated.

16 Nov 2012, 9:14 PM
#16
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,871
Plugin Contributions:
7

Re: French translation and special characters

Well, I've proved it works on a vanilla ZC 1.51 with only those changes.

If you are using obsolete 1.39 code you need to do the same procedure on a new 1.39 install (with the db collation created as utf-8_general): make those changes and test...prove there is something else required for 1.39 or its your code.

16 Nov 2012, 9:48 PM
#17
abcisme avatar

abcisme

Zen Follower

Join Date:
Jun 2006
Posts:
298
Plugin Contributions:
0

Re: French translation and special characters

I stand corrected. When I used the solution posted on zencart-france.com (which was to add html_entities_decode), I would get no characters, even though the html_entities_decode should work.

When I remove the html_entities_decode solution that was provided at zencart-france.com and input the accented characters directly vs. using the html entities, I get the proper characters.

So you're right. I have to go through everything related to the text emails and replace the html entities with the accented characters. (FUN!)

I was hoping that the solution would have been as simple as using html_entities_decode or another function to decode the html entities.

Thanks for taking a look at it and sorting it out.

ETA: For anyone else who has to do the same thing - here's a great tool for converting ISO-8859-1 to UTF-8: http://www.unicodetools.com/unicode/utf8-to-latin-converter.php

16 Nov 2012, 11:07 PM
#18
abcisme avatar

abcisme

Zen Follower

Join Date:
Jun 2006
Posts:
298
Plugin Contributions:
0

Re: French translation and special characters

Ok, so what's going on here? I put the correct characters in the payment method text file:

define('MODULE_PAYMENT_OFFSITEPAYMENT_TEXT_TITLE', 'Payer par téléphone (Paiement hors connexion)');

On the site it shows:

Payer par t�l�phone (Paiement hors connexion)

In the email it shows:

Payer par tlphone (Paiement hors connexion)

This is so frustrating. Everything is set to UTF-8. I give up.

17 Nov 2012, 7:01 AM
#19
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,871
Plugin Contributions:
7

Re: French translation and special characters

Which payment module is this?

17 Nov 2012, 9:00 AM
#20
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,871
Plugin Contributions:
7

Re: French translation and special characters

Just for "interest" :wacko: I wrote some php that converted all the files back to normal characters, pm me with your email address and I'll send you the fileset.

I'll put it up on Sourceforge later so that someone can use it to update the files and the translation to 1.51.