WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Bakery Shop => Topic started by: rumen on May 30, 2016, 01:20:54 PM

Title: How to fix laguage issue with e-mail confirmation
Post by: rumen on May 30, 2016, 01:20:54 PM
How to fix the confirmation by e-amil for order done in Bakery?

If it is in Cyrillic the e-mail looks like that:

Code: [Select]
Thank you for shopping at apokalypsabg.org.
Please find below the information about the products you have ordered:

Арт.№: 101
Product Name: Заглавие
Количество: 1
Цена: BGN 16.00
Доставка: BGN 6.00
Сума: BGN 16.00

-------------------------------------
Междинен сбор: BGN 16.00
Доставка: BGN 6.00
-  0.0% Данък: BGN 0.00
-------------------------------------
-------------------------------------
Общо: BGN 22.00
-------------------------------------

We will ship the order to the address below:

no
Rumen Zapryanov
busmanci, cyklama 2
-1520 Sofia
Sofia


+359 876 415 001
 

In the language file I didn't saw the translations. Where they can be and where I can define the code because it seems it is not UTF-8
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: Gast on May 30, 2016, 01:49:13 PM
do you use the latest bakery Version?
the russian language file there is encoded in utf8 / without boom
to see the language variables in (for you) readable text, you need a decoder like notepad++

Here a pic with some line of this file in notepad++
(https://i.gyazo.com/5ecf544f39bc0a2f5f046ee17c25be5e.png)

to the mail...look into the mail-source-code to the header of this email and there specially to the used charset. Search for entries like this
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed

alsopossible, that your mailserver doesnt support utf8 (like the german gmx)
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: rumen on May 30, 2016, 02:30:15 PM
My mailer by default is set to utf-8.

I did new language file for BG. I translated most of it. But the e-mail confirmation I think is not from that file. I did't find any of the English sentences there -  like "Thank you for shopping at"

That means that these can be somewhere else not in the language file and if there is not defined the language code ... So where can be that?

The language file is OK here is part of it:

(http://apokalypsabg.org/media/bakery_translate.png)
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: Gast on May 30, 2016, 02:51:02 PM
My mailer by default is set to utf-8.

I did new language file for BG. I translated most of it. But the e-mail confirmation I think is not from that file. I did't find any of the English sentences there -  like "Thank you for shopping at"

That means that these can be somewhere else not in the language file and if there is not defined the language code ... So where can be that?

have you check the language files in the used payment methodes? (folder: modules/bakery/payment method/all used payment methodes)

P.S.: i see the module "language-edit" - is it the old module from2007/2008 or a newer version?  if the old one, be carefull with it, its very dangerous. its recommened to remove it from the online server if you finish with your work. its possible to overtake the database control.

Tip: use a locale wb-portable to work with this module, install it in the WB-Demo-Project
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: rumen on May 30, 2016, 02:54:36 PM
Thanks for the hint - I will check payment methods - maybe the issue comes from there.

Language edit:

Module Details
Name:    Language Edit
Type:    Administration tool
Author:    John and Peter Gilbane, M. Gallas, R. Smith, C. Sommer, thorn
Version:    0.91
Designed For:    Website Baker 2.6.x - 2.7
Description:    This allows you to edit a language file, and download installable zipped packages of the edited templates.
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: rumen on May 30, 2016, 04:13:17 PM
I bought from the Bulgarian version, by definition it should use the Bulgarian file language. But in the e-mail I get the English version.

It is strange also that I choose "Method of payment" to be a "Cash on delivery" - I save the settings and when I enter again on the place, where is the method of payment is "Advance payment" see the pic's:

(http://apokalypsabg.org/media/payment0.png)

(http://apokalypsabg.org/media/payment1.png)

 
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: rumen on May 30, 2016, 04:24:06 PM
And the issue with the e-mail confirmation is the same (texts like Thank you for shopping at apokalypsabg.org. should be in Bulgarian in this case.):

Code: [Select]
Dear Rumen Zapryanov

Thank you for shopping at apokalypsabg.org.
Please find below the information about the products you have ordered:

Арт.№: 101
Product Name: Заглавие
Количество: 1
Цена: BGN 16.00
Доставка: BGN 6.00
Сума: BGN 16.00

Арт.№: 102
Product Name: Заглавие
Количество: 1
Цена: BGN 12.00
Доставка: BGN 6.00
Сума: BGN 12.00

-------------------------------------
Междинен сбор: BGN 28.00
Доставка: BGN 12.00
-  0.0% Данък: BGN 0.00
-------------------------------------
-------------------------------------
Общо: BGN 40.00
-------------------------------------

We will ship the order to the address below:

no
Rumen Zapryanov
busmanci, cyklama 2
-1520 Sofia
Sofia
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: Gast on May 30, 2016, 07:44:41 PM
I bought from the Bulgarian version, by definition it should use the Bulgarian file language. But in the e-mail I get the English version.

It is strange also that I choose "Method of payment" to be a "Cash on delivery" - I save the settings and when I enter again on the place, where is the method of payment is "Advance payment" see the pic's:

back at home from the doc - now step by step  ;-)

the language for the confirmation form and also for the confirmation emails are defined in view_confirmation.p hp in this part

Code: [Select]
// Look for payment method language file
        if (LANGUAGE_LOADED) {
                include(WB_PATH.'/modules/bakery/payment_methods/'.$payment_method.'/languages/EN.php');
                if (file_exists(WB_PATH.'/modules/bakery/payment_methods/'.$payment_method.'/languages/'.LANGUAGE.'.php')) {
                        include(WB_PATH.'/modules/bakery/payment_methods/'.$payment_method.'/languages/'.LANGUAGE.'.php');
                }
        }

it means: load as a basic language the english language file from the payment-method-folder
plus
if there is a file with a valid language code from the selected language on this (frontend-)page, load this file.

the last loaded definition from a language variable replace then the english variable. is one of the variable not defined in your used language, take the variable from the english file.

the english file is the main file and included all!!! language variables, in wb-core, in bakery main language file and also in the payment method.

So, for you:
- be sure, that u use the correct language code for the bulgarian file (BG.php)
- be sure, that you have a file with this name (BG.php) in every in your shop activated payment-method-language-folder
- be sure, that you have a translation in this! BG.php for every in the EN.php used language variable

some little helpers... but be carefull, if you work on the online project and not on a test-page

search in view_confirmation.p hp for this code, its nearly on the top. replace the EN in this line
Quote
include(WB_PATH.'/modules/bakery/payment_methods/'.$payment_method.'/languages/EN.php');
with the BG for a test, so its load only the BG.php and everything must be come in your favorite language
visible only in the confirmation-mails
Dont forget to remove it after the test or it use the bulgarian language also on english pages (or better:) in the confirmation mail for a english speaker

if i look to your last post.... another simple tip.... 
if you are not sure about the chars in your mail, copy all this chars from your email, go to a WB-Page with a wysiwyg-Editor, switch to source-code and add there your text, then switch back to the normal editor view (preview) and you see a translation like this

(https://i.gyazo.com/f27fd02ffb3822b50cc4dd9dba764cd3.png)

it looks, that your bakery or your mailserver use htmlspecialchars to display the cyrillic chars. i did not found a function for that in the actual bakery version. bakery has a own phpmailer, so it has nothing to do with the wb-mailer
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: rumen on May 30, 2016, 08:14:11 PM
I changed the language in view_confirmation.p hp and try to input new order.

I got error when I entered the names in Cyrillic:

(http://apokalypsabg.org/media/error_bakery_cyrillic_input.png)
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: rumen on May 30, 2016, 08:18:10 PM
When I changed the names in Latin letters I got the order - done, but the confirmation is the same:

Code: [Select]
Dear Rumen Zapryanov

Thank you for shopping at apokalypsabg.org.
Please find below the information about the products you have ordered:

Арт.№: 101
Product Name: Заглавие
Количество: 1
Цена: BGN 16.00
Доставка: BGN 6.00
Сума: BGN 16.00

Арт.№: 103
Product Name: Заглавие
Количество: 1
Цена: BGN 11.00
Доставка: BGN 6.00
Сума: BGN 11.00

-------------------------------------
Междинен сбор: BGN 27.00
Доставка: BGN 12.00
-  0.0% Данък: BGN 0.00
-------------------------------------
-------------------------------------
Общо: BGN 39.00
-------------------------------------

We will ship the order to the address below:

Rumen Zapryanov
busmanci, cyklama 2
-1520 Sofia
Sofia
Title: Re: How to fix language issue with e-mail confirmation
Post by: freeSbee on May 30, 2016, 09:47:56 PM
Hi Rumen

1.
In your Bakery language files do not replace Cyrillic characters by html entities, especially not in email text. Just use Cyrillic chars and save the file using utf-8 encoding.

2.
Your main Bakery localization file BG.php must include code to define additional charset to be accepted by the customer address form validation. Add this to the file:

Code: [Select]
// ADDRESS FORM VALIDATION
$MOD_BAKERY['ADD_CHARSET'] = 'Cyrillic';

Regards Christoph
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: rumen on May 30, 2016, 09:54:32 PM
Hello,

this should be applied to ../modules/bakery/languages/BG.php only, or to all language files? In bakery I saw many of them like ../modules/bakery/payment_methods/cod/languages/BG.php
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: rumen on May 30, 2016, 11:52:29 PM
It works now!!!!

I put that code ini all BG.php files (for any case), I changed the code in the Backend (Payment method) and now it works!

Thanks a lot for the help freeSbee and jacobi22
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: freeSbee on May 31, 2016, 08:43:53 AM
Hi Rumen

this should be applied to ../modules/bakery/languages/BG.php only, or to all language files? In bakery I saw many of them like ../modules/bakery/payment_methods/cod/languages/BG.php
As mentioned in my post above (2.) (http://forum.WebsiteBaker.org/index.php/topic,29246.msg205213.html#msg205213) it complies with Bakery if you add it to the main localization file /bakery/languages/BG.php

Regards Christoph
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: rumen on May 31, 2016, 10:22:40 AM
Thanks a lot! I think it works perfect now!
Title: Re: How to fix laguage issue with e-mail confirmation
Post by: Gast on May 31, 2016, 01:34:04 PM
2.
Your main Bakery localization file BG.php must include code to define additional charset to be accepted by the customer address form validation. Add this to the file:

Code: [Select]
// ADDRESS FORM VALIDATION
$MOD_BAKERY['ADD_CHARSET'] = 'Cyrillic';

i have never used cyrillic chars in bakery, but its good to know  (Y)