https://github.com/appleple/lang-select
https://github.com/appleple/lang-select
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/appleple/lang-select
- Owner: appleple
- License: mit
- Created: 2020-07-01T06:42:56.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T19:54:08.000Z (over 3 years ago)
- Last Synced: 2025-01-09T11:55:39.780Z (over 1 year ago)
- Language: JavaScript
- Size: 11.9 MB
- Stars: 1
- Watchers: 5
- Forks: 1
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lang-select
[](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 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
クリック
```