1.0.2 • Published 2 years ago

gs-language-picker v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

INSTALL

npm install gs-language-picker

EXAMPLES

import { LanguagePicker } from '../dist';

const options = {
    apiUrl: 'http://ip-api.com/json', // API URI to get location info, json response
    cookieKey: 'language', // Cookie key
    apiLocationExtractKey: 'countryCode', // Key to extract country code from api
    supportLanguages: { 'VN': 'vi' } // Supported languages you set, with key is country code, value is language
}

let language = new LanguagePicker(options)

// Get language and set it to your cookie
language.getLanguage().then((lang) => {
    console.log(lang);
});

// Set language to your cookie
language.setLanguage('en');
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago