E Mail Templates Language

Hello.

I dont understand the following: I have 3 different languages. For every E Mail template I have a native language version.

Now, if a user register and at the registration process he use for example spanish, then the messages, for example the profile activation message are always english. And not spanish for example. Why?

How can I do it that the user get the messages in the language he use on my site?

Thanks.

Jay

Quote · 25 Jan 2012

Make sure that:

- you have "Spanish" translation on the site

- you have "Spanish" translation for the email template

- user switched from the default (English) language to Spanish, only when user switches from default language to Spanish - the Spanish language is saved in their profile and next time when email is sent, Spanish email template is used.

Rules → http://www.boonex.com/terms
Quote · 25 Jan 2012

Ok, thanks.

But the visitor arrives at my index page. Then the language is auto changed to spanish because he has spanish browser language. Then he registers (at spanish). And then the registration confirmation is sent english and not spanish. Normally it has to be spanish or not? Or did the user has to register first and then change the language? But its already the language he needs at this time because its changed before registration.

Quote · 27 Jan 2012

User's language is changed in his profile from default one only when user manually changes language. 

On your site it is changed automatically from browser language and user don't need to change it manually, so profile is not updated and email is send in English.

Rules → http://www.boonex.com/terms
Quote · 30 Jan 2012

So the user can't change the language before logging in to his member area? (A change which effects the Email language)

Then the profile activation message is always english for all users? Because its the first message before any user can login to his profile. (And change there manually the language)

Quote · 31 Jan 2012

might work if you set  the default lang..

Quote · 31 Jan 2012

Try to insert the following code:

        // update profile language
        setLangCookie(getCurrentLangName());

in inc/classes/BxDolJoinProcessor.php file, before the following lines (~291):

        //--- create system event
        bx_import('BxDolAlerts');
        $oZ = new BxDolAlerts('profile', 'join', $iId1, 0, array('status_text' => &$sStatus1));
        $oZ->alert();

Please test it carefully and if it works good, it will be implemented in upcoming version.

Rules → http://www.boonex.com/terms
Quote · 1 Feb 2012

My "default" language for the email templates is in german. The whole system works for different user languages. Only on join i cannot get english users to receive the english join email. The website is already in english because dolphin detects the browser language and i also checked with getCurrentLangName() which returns english.

I tried your patch Alex but its not working, still the default language email templates are being used. Is there any other way to send emails based on getCurrentLangName()?

Check my GeoDistance, Watermark, TorBlock and Android Push Notifications mods | http://goo.gl/H3Vp81
Quote · 10 May 2012

There is a problem in above example - member's language is updated after welcome letter is sent.

Try to do this mod:

Insert the following code:

// set default language
$aNewProfile['LangID'] = (int)db_value( "SELECT `ID` FROM `sys_localization_languages` WHERE `Name` = '" . process_db_input(getCurrentLangName()) . "'" );

before the following:

$sSet = $this -> collectSetString( $aNewProfile );
$sQuery = "INSERT INTO `Profiles` SET \n$sSet";

in inc/classes/BxDolProfilesController.php file.

Please let me know how it goes, if everything is fine we will add it to next Dolphin patch.

My "default" language for the email templates is in german. The whole system works for different user languages. Only on join i cannot get english users to receive the english join email. The website is already in english because dolphin detects the browser language and i also checked with getCurrentLangName() which returns english.

I tried your patch Alex but its not working, still the default language email templates are being used. Is there any other way to send emails based on getCurrentLangName()?

 

Rules → http://www.boonex.com/terms
Quote · 11 May 2012

Hello Alex, thanks for your help.

I tried it but the email still goes out with the default language template (which in my case is german - LangID 0).

Anyway, I checked the profile table and your code correctly set 1 (english) as the users LangID.

PS: I didn't applied the patch before, only yours.

Check my GeoDistance, Watermark, TorBlock and Android Push Notifications mods | http://goo.gl/H3Vp81
Quote · 11 May 2012

It looks some more changes are need.

1) Change:

$aTemplate = $this -> oEmailTemplate -> getTemplate( 't_Activation' ) ;

to:

$aTemplate = $this -> oEmailTemplate -> getTemplate( 't_Activation', $iMemID ) ;

2) Change:

$aTemplate = $this -> oEmailTemplate -> getTemplate( 't_Confirmation' ) ;

to:

$aTemplate = $this -> oEmailTemplate -> getTemplate( 't_Confirmation', $iMemID ) ;

in inc/classes/BxDolProfilesController.php file.

Please let me know how it goes, if everything is fine we will add it to next Dolphin patch.

 

Rules → http://www.boonex.com/terms
Quote · 13 May 2012

Hi Alex,

after applying these additional lines of code i can confirm now that it works like expected. All joined users get the email in the language their browser uses an/or in the language they manually changed in the language selector.

Many thanks!!!

Check my GeoDistance, Watermark, TorBlock and Android Push Notifications mods | http://goo.gl/H3Vp81
Quote · 13 May 2012

Thank you for checking.

http://www.boonex.com/trac/dolphin/ticket/2788

Rules → http://www.boonex.com/terms
Quote · 15 May 2012

Hello Alex,

i must correct myself, there is still a problem with the email being send, just today i found out why this happens. Your code before works, but it doesn't cover all cases.

My Setup is the following:

Default = LangID 0 (German in my case)
English = LangID 1

German visitors get a german dolphin by default and all others get an english site. Now comes some steps to reproduce a problem:

 

1) Logon with a profile

2) Switch to LangID 1 (english in my example)

(Profiles->LangID shows correct set value for this language)

3) Logoff from that profile and delete Cache/Cookie

4) Logon again

5) Site again in german which is ok for me even Profile table shows different value

6) The problem comes when a member receives an email from dolphin system, it's english! Thats strange for members because they log in and see the site is in german. How they can know they should switch to english in the menu and then again back to german to update table Profiles?

Check my GeoDistance, Watermark, TorBlock and Android Push Notifications mods | http://goo.gl/H3Vp81
Quote · 21 Aug 2012

It maybe that the problem in LangID = 0, please can you try to use non-zero positive number for all languages ?

Hello Alex,

i must correct myself, there is still a problem with the email being send, just today i found out why this happens. Your code before works, but it doesn't cover all cases.

My Setup is the following:

Default = LangID 0 (German in my case)
English = LangID 1

German visitors get a german dolphin by default and all others get an english site. Now comes some steps to reproduce a problem:

 

1) Logon with a profile

2) Switch to LangID 1 (english in my example)

(Profiles->LangID shows correct set value for this language)

3) Logoff from that profile and delete Cache/Cookie

4) Logon again

5) Site again in german which is ok for me even Profile table shows different value

6) The problem comes when a member receives an email from dolphin system, it's english! Thats strange for members because they log in and see the site is in german. How they can know they should switch to english in the menu and then again back to german to update table Profiles?

 

Rules → http://www.boonex.com/terms
Quote · 21 Aug 2012

I am willing to bet that's the problem. Id's of 0 are not normal. The database indexes start at 1.

Curious to know how it ended up that way.

English is normally the default in dolphin with a langid of 1.

All added languages should get the next available ID which would be 2 which is what your german language should have.

https://www.deanbassett.com
Quote · 22 Aug 2012

Maybe i was not very clear....


In email-templates i use "Default" selection with a german text, "English" with english text and "German" with german text.

 
0 = I dont know, i thought its the index for default language as can be seen in the email templates


If you choose a language manually from the menu, it always selects these two values

1 = English

2= German

If you are a new user and never touch the the language menu the members profile record carries a LangID of 0

I just double checked with a fresh installation of dolphin.

Check my GeoDistance, Watermark, TorBlock and Android Push Notifications mods | http://goo.gl/H3Vp81
Quote · 22 Aug 2012

Yes, it looks like the problem has place, please try this fix:

http://www.boonex.com/trac/dolphin/changeset/16789

And let me know how it goes.

Rules → http://www.boonex.com/terms
Quote · 29 Aug 2012

Hello Alex,

i applied the patch to 7.0.9 and it seems to work.

New users don't get 0 as their default LangID anymore. So the rest of the system should send the emails out in the language they see on their screen, no matter if they touched the language menu before or not.

Thanks very much

Check my GeoDistance, Watermark, TorBlock and Android Push Notifications mods | http://goo.gl/H3Vp81
Quote · 29 Aug 2012

Hello,

Think there's a coding bug in the fix for http://www.boonex.com/trac/dolphin/changeset/16789

In file languages.inc.php,

         function getLangNameById($sLangId) {
             return (int)db_value( "SELECT `Name` FROM `sys_localization_languages` WHERE `ID` = '" . (int)$sLangId . "'" );
         }

SHOULD BE

         function getLangIdByName($sLangId) {
             return (int)db_value( "SELECT `Name` FROM `sys_localization_languages` WHERE `ID` = '" . (int)$sLangId . "'" );
         }

because it is defined below as

         function getLangIdByName($sLangId) {
             return (int)db_value( "SELECT `Name` FROM `sys_localization_languages` WHERE `ID` = '" . (int)$sLangId . "'" );
         }

as per the ticket http://www.boonex.com/trac/dolphin/ticket/2788

Quote · 3 Sep 2012

 Thank you for pointing this out, corrected - http://www.boonex.com/trac/dolphin/changeset/16815

Hello,

Think there's a coding bug in the fix for http://www.boonex.com/trac/dolphin/changeset/16789

In file languages.inc.php,

         function getLangNameById($sLangId) {
             return (int)db_value( "SELECT `Name` FROM `sys_localization_languages` WHERE `ID` = '" . (int)$sLangId . "'" );
         }

SHOULD BE

         function getLangIdByName($sLangId) {
             return (int)db_value( "SELECT `Name` FROM `sys_localization_languages` WHERE `ID` = '" . (int)$sLangId . "'" );
         }

because it is defined below as

         function getLangIdByName($sLangId) {
             return (int)db_value( "SELECT `Name` FROM `sys_localization_languages` WHERE `ID` = '" . (int)$sLangId . "'" );
         }

as per the ticket http://www.boonex.com/trac/dolphin/ticket/2788

 

Rules → http://www.boonex.com/terms
Quote · 4 Sep 2012
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.