First you will need to find out your visitor's default language and his or her IP address (for fallback). Example functions:
Once we have user's language and IP address we'll call http://fourtonfish.com/hellosalut/?lang=LANGUAGECODE&ip=IPADDRESS and HelloSalut will return the country code (or language code) and the translation for the word "Hello".
If you have a Mashape or GitHub account, you can try the API on mashape.com
Note: The language setting has a higher priority than IP. You can choose to either only supply the IP address or only the language (not recommended right now due to limited amount of supported languages, see below for full list). If the language or IP can not be matched, default value of "Hello" will be returned.
Now we can say hello!
You can make a call to http://fourtonfish.com/hellosalut/?mode=auto to have HelloSalut determine the correct language automatically. The functions currently in use are the same as example functions above.
The service is currently in beta while I'm adding more countries and languages. This is a list of countries that are currently supported based on IP:
Afghanistan, Albania, American Samoa, Andorra, Angola, Anguilla, Antarctica, Antigua and Barbuda, Argentina, Armenia, Aruba, Australia, Austria, Azerbaijan, Bahamas, Bahrain, Bangladesh, Barbados, Belarus, Belgium, Benin, Bermuda, Bolivia, Bosnia and Herzegovina, Brazil, British Indian Ocean Territory, Brunei Darussalam, Bulgaria, Burkina Faso, Burma (Myanmar), Burundi, Cambodia, Canada, Chile, China, Colombia, Croatia, Cyprus, Czech Republic, Denmark, Egypt, Estonia, Europe, Finland, France, French Guiana, French Polynesia, French Southern Territories, Georgia, Germany, Greece, Guyana, Hong Kong, Hungary, Iceland, India, Indonesia, Ireland, Israel, Italy, Jamaica, Japan, Kazakhstan, Kenya, Korea (North), Korea (South), Laos, Latvia, Lithuania, Luxembourg, Macedonia, Malaysia, Malta, Mexico, Mongolia, Nepal, Netherlands, Netherlands Antilles, New Zealand, Niger, Norway, Oman, Pakistan, Peru, Philippines, Poland, Portugal, Puerto Rico, Republic of Serbia, Romania, Russia, Saudi Arabia , Serbia and Montenegro, Singapore, Slovak Republic, Slovenia, South Africa, Spain, Sweden, Switzerland, Taiwan, Thailand, Turkey, Ukraine, United Arab Emirates, United Kingdom, United States, Uruguay, Venezuela, Vietnam, Virgin Islands (British) and Virgin Islands (U.S.)
Supported browser languages:
cs, de, en-gb, en-us, es, fr, is, ja, sk
If you come across any issues, notice any mistakes in translations or would like me to add a particular country or language sooner, please let me know at firstname.lastname@example.org or @fourtonfish Also feel free to contact me if you would like your site to be listed below.