Hello, Salut!

Need a quick intro to web APIs? Check out my tutorial!

Say hello to your visitors in their native language!

  1. Get your visitor’s IP address and/or default language using your preferred methods.
  2. Make a call to HelloSalut.
  3. Say hello!

You can also skip the first step and use the fully automatic mode.

How to use

Manual mode

In the manual mode, you can pass your visitor’s default browser language and/or their IP address to HelloSalut. Here are some example functions using PHP:

Once we have user’s language and IP address we can make a call to https://hellosalut.stefanbohacek.dev/?lang=LANGUAGECODE&ip=IPADDRESS and HelloSalut will return the country code (or language code) and the translation for the word “Hello”.

Some examples:

Note: The language setting has a higher priority than the IP address. 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.

Here’s a simplified example of an API request made with fetch.

fetch( 'https://hellosalut.stefanbohacek.dev/?mode=auto' )
.then( function( response ){
  return response.json()
} )
.then( function( jsonData ){
  console.log( jsonData ) 
} );

And the result:

{
  "code": "en-us",
  "hello": "Hi"
}

Now we can say hello!

Automatic mode

You can make a call to https://hellosalut.stefanbohacek.dev/?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 address:

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:

ar, az, be, bg, bn, bs, cs, da, de, dz, el, en, en-gb, en-us, es, et, fa, fi, fil, fr, he, hi, hr, hu, hy, id, is, it, ja, ka, kk, km, ko, lb, lo, lt, lv, mk, mn, ms, my, ne, no, pl, pt, ro, ru, sk, sl, sq, sr, sv, sw, th, tk, uk, vi, zh

The database (which is a modified version of the database from ip2nation.com) and the PHP code that handles it are available on Github. There is also a partial export of the data on Kaggle.

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 stefan@stefanbohacek.com or @stefanbohacek.

Demos and examples

A tinted screenshot of a section of the jointhefediverse.net explaining how the fediverse works.

Join The Fediverse.net

A gentled introduction to the future of social media.

#explainer #fediverse #social-media

A screenshot of Kaelin Ellis playing a keyboard in a video for his song Peanuts.

💻 Browse all