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

https://github.com/jastinxyz/basa

a javascript library that allows your website to be multi-language with ease of use.
https://github.com/jastinxyz/basa

i18n

Last synced: 28 days ago
JSON representation

a javascript library that allows your website to be multi-language with ease of use.

Awesome Lists containing this project

README

        

# Basajs

a javascript library that allows your website to be multi-language with ease of use.

## Installation

Add script in the ``:
```html

```

## Use It

### Basic
```html


id
en

const dict = {
hello: {
id: "halo",
en: "hello",
},
greeting: {
id: "selamat datang",
en: "welcome",
},
};

Basa.init({
languages: ["id", "en"],
useLocalStorage: true,
dictionary: dict,
});

```

### Nested
```js
const dict = {
hello: {
top: {
id: "halo",
en: "hello"
}
}
}
```

use it with
```html


```

## Default Settings

```js
Basa.init({
languages: [], // language array
useLocalStorage: false, // if true, localstorage will store the language in the `lang` key which can be used if the client revisits the page, the language will automatically use the one in localstorage
addActiveClass: false, // if true, it will add the "active" class to the element with the id being the name of one of the provided languages
dictionary: {} // translation object
});
```