2020-11-30, 10:38 AM
I want to personalize the content of the website to its visitors based on what language they speak. I see two ways to do this:
1) locate a visitor's IP. My logic is: if visitors access from IP in Paris, they speak French and would like to read content in French. All I need is to use a geolocation API that is easy to find, like this one so far https://www.abstractapi.com/ip-geolocation-api.
However, if I have visitors from Canada, they can speak English or French or both. How to know which language to use in that case?
So, I'm thinking of option #2.
2) rely on a visitor's browser accept-language header. But I'm wondering how accurate is it? What can be the drawbacks of this approach?
Let me know please how you tailor the language of the content to website visitors.
Thanks!
1) locate a visitor's IP. My logic is: if visitors access from IP in Paris, they speak French and would like to read content in French. All I need is to use a geolocation API that is easy to find, like this one so far https://www.abstractapi.com/ip-geolocation-api.
However, if I have visitors from Canada, they can speak English or French or both. How to know which language to use in that case?
So, I'm thinking of option #2.
2) rely on a visitor's browser accept-language header. But I'm wondering how accurate is it? What can be the drawbacks of this approach?
Let me know please how you tailor the language of the content to website visitors.
Thanks!