Support

Home Forums Community Forum HOW TO: Multi Language Booking & Event Espresso (a workaround)

HOW TO: Multi Language Booking & Event Espresso (a workaround)

Posted: December 2, 2016 at 7:16 am


c.network

December 2, 2016 at 7:16 am

So I had to create a site that will host tickets for various events in two Primary Languages.
The issue is that EE & common plugins such as WPML dont like to talk together. So EE (with booking pages etc) will remain in the default language state that the site is in while the rest of your content will change languages according to language plugin.

I wasnt happy with this and I know that EE have lost a few customers over this. So I wanted to find a solution.

In wordpress there is a way that you can dynamically change the language for each user that browses your site. This used to be done by defining WPLANG in your wp-config – but this has now all been depreciated. So I went hunting….

After two hours, 500 open tabs and more than 20 versions of my wp-config.php I found a solution.

PLEASE NOTE!!!!
This will probably not work if you have a plugin such as WPML installed. I tried it and WPML broke it.
ALSO
This will only translate the EE pages that a client will see when booking.
This will not translate your actual content – this should be done by yourself either having two languages of text on one page or creating two pages – or even just using columns.
I may look at another way of doing this in the future!

The Work Around

PART 1

Simply edit your site’s wp-config.php and paste the following text


if(!session_id()) {
session_start();
}
$custlang = $_GET['lang'];
if ( !empty($custlang) ){
$_SESSION["customlang"] = $custlang;
};

$locale = $_SESSION["customlang"];

PART 2

FOR EACH LANGUAGE
Create menu buttons using the “Custom Links” option in the menu selection.
For the URL enter “?lang=xx_XX” where xx_XX is the two letter language and country code you want (e.g. de_DE, en_US, es_ES etc).
For the Link Title enter the name of the language.

Done!

I will work on possibly making this into a plugin in the future. but for now it works as I need it.

DISCLAIMER
I am not a profession web dev and my php skills are as rusty as a ship at the bottom of the ocean. I hold no responsibility if this kills your site. Make a backup if you are concerned. Read through the code and make sure you understand it.


jfchatelain

December 17, 2016 at 9:47 am

This is great! Thanks for that.

Do you have any advices on how the questions labels can be translated after pressing the register now button?

Thanks for your help

The support post ‘HOW TO: Multi Language Booking & Event Espresso (a workaround)’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso