2

I use Internationalization module on Drupal 7 for multi-language content and my default language is English and I have one more language.

The thing I have to do is:

  1. To check if visitor is from country that primary language is my second language on website (there are four countries that language is spoken), I think that this checking can be done by IP address of visitor.

  2. If visitor is from one of that countries there will be shown modal popup with the question if the visitor wants that page to be shown in his language. If visitor answers affirmative that page will be shown in his language, but if he answers negatively the page will be shown in default language (English).

  3. It is necessary to remember visitor choice so that the modal popup doesn't show up every time, I think that it could be done by saving the cookie in visitor's browser.

Is this possible to be done through some module or the combination of modules or it is necessary to be done programmatically?

Any idea or help where to start is welcome, also the suggestion of some different concept would be nice.

1 Answer 1

2

Just some ideas: I remember a WordPress multilanguage plugin setting that I had the option

Detect the language of the browser and redirect accordingly.

That must work similar for Drupal. So, I'ld guess you would try that browser language approach. D6 even had an own function for this language_from_browser. I bet there must be something in D7 for that as well.

Once you have the language you might conditionally display the modal window from that. Inside the modal then there'ld be a little form, maybe just two submit buttons "Yes language", "No language", something like that.

Inside your form submit function you may find a way to trigger the redirect to the chosen language. Finally you might want to save the user's answer in a $_SESSION variable and bind that as a condition for the modal display also.

Put all of that in a little custom module and let us know how you've done!

1
  • thanks for respond...Internationalization already has option for detecting browser language...right now I don't have too much time to do this so I looking for some simpler solution...
    – mixerowsky
    Jul 26, 2014 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.