0

So I basically want to localize a website, but not only the text is supposed to change (like with a JSON), but also the CSS and Image Files etc. I want something that checks the IP of a visitor and then redirects him to the correct version of the site.

I could imagine a small index.php file that does that, or a service that is made for this purpose. Is there anything that I can do?

fabe
  • 15
  • 4
  • perhaps this will help? http://stackoverflow.com/questions/8199760/how-to-get-the-browser-language-using-javascript – Daniel Cheung Apr 25 '14 at 15:41
  • be careful, someone might flag you as duplicate ;) check before you ask – Daniel Cheung Apr 25 '14 at 15:41
  • I want something rather server-sided, but this is helpful nonetheless. Thanks! – fabe Apr 25 '14 at 15:43
  • maybe this?: http://stackoverflow.com/questions/13585100/how-to-get-user-language-by-ip-address-using-php – Daniel Cheung Apr 25 '14 at 15:45
  • well, looks like you're right. i'll try to solve it with js :) – fabe Apr 25 '14 at 15:46
  • php may be powerful, but it is however serversided, it does not have authority to do many things related to a client. on the other hand, js is the a language specifically to do scripting on a client's side. that is how internet security works. – Daniel Cheung Apr 25 '14 at 15:50

2 Answers2

0

If you grab the location with a service (I don't know of any), but then you could style the webpage by including PHP files that run their queries based on the location grabbed. I.E. If they log in from North America the services runs your PHP files with country=1, and grab all the related styling information from a database. South America could be country=2 etc etc however you want to section it up, although i would recommend having a default incase you can't grab their location.

PugsOverDrugs
  • 515
  • 1
  • 4
  • 14
0

Try this PHP library :

Download here

Check examples of the function that's gonna be useful for you here

This function allows you to detect language in pure PHP, put it in a variable, and then what you'll have to do is call the right .css file.

Nicolas Marshall
  • 4,186
  • 9
  • 36
  • 54