An open API service indexing awesome lists of open source software.

https://github.com/appleple/lang-select


https://github.com/appleple/lang-select

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

          

# lang-select

[![GitHub license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://raw.githubusercontent.com/appleple/document-outliner/master/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/](http://tajima.appleple.jp/sample/LangSelect/example/en/)

## Usage
```html

```

Write "div tag" and "javascript".
```html

window.addEventListener('DOMContentLoaded', function(){
new LangSelect("foo", [
{"lang": "language code of ISO 639", "url": "http://example.com", "message": "message", "btn_message": "message on button"},
])});

```

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.
```html



message




message on button





```

## Example

```html

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

```

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



日本向けサイトがあります




クリック





```