Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 1.17 KB

README.md

File metadata and controls

39 lines (26 loc) · 1.17 KB

lang.js

Visits Badge

lang.js is a simple library that help you with multilanguage sites.

View user language

Use this to view the main user language

navigator.lang
// Console returns your favourite language

Check user language

Use this to check if the input language is the main language

navigator.islang("en")
// Console returns true if user use english

Callback function if user use a specific language

Use this for callback functions that require a specific user language

navigator.iflang("en", callback)
// For example, if user use english and callback returns true, the console returns true, too.

Watch out

This library is useful only if you want to know user language, not user nationality: for example, you can't know if a user is American or British, you can only know if they speak English.

Test lang.js

If you want test this library, click here.