Skip to content

Repository files navigation

lang-select

GitHub license

A utility to suggest page transition when a visitor is browsing the site written in not his/her first language. http://tajima.appleple.jp/sample/LangSelect/example/en/

Usage

<scriptsrc="js/lang-select.js"></script>

Write "div tag" and "javascript".

<divid="foge"></div><script>window.addEventListener('DOMContentLoaded',function(){newLangSelect("foo",[{"lang": "language code of ISO 639","url": "http://example.com","message": "message","btn_message": "message on button"},])});</script>

If a visitor is browsing the site written in not his/her first language and LangSelect instance has "url" of his/her first language, "div tag" becomes as below.

<divclass="active" id="foge"><divclass="message"><p>message</p></div><divclass="change-site"><buttononclick="http://example.com">message on button</button></div><divclass="reject-message"><button></button></div></div>

Example

<divid="foge"></div><script>window.addEventListener('DOMContentLoaded',function(){newLangSelect("foo",[{"lang": "ja","url": "../ja/index.html","message": "日本向けサイトがあります","btn_message": "クリック"},])});</script>

If a visitor is browsing the site written in not visitor's first language and he/she use Japanease, "div tag" becomes as below.

<divid="foge"><divclass="message"><p>日本向けサイトがあります</p></div><divclass="change-site"><buttononclick="ユーザが入力した遷移先">クリック</button></div><divclass="reject-message"><button></button></div></div>

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages