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.
- Host: GitHub
- URL: https://github.com/jastinxyz/basa
- Owner: JastinXyz
- License: mit
- Created: 2023-02-19T06:01:54.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-04T17:06:11.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T10:39:15.733Z (7 months ago)
- Topics: i18n
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
enconst 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
});
```