# jang

> For client-side language text

Latest version **1.0.2** (published 2018-11-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install jang
pnpm add jang
yarn add jang
bun add jang
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-11-15 |
| First published | 2018-11-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | JosephUz |
| Maintainers | josephuz |
| Keywords | client-side, language |

## Links

- npm: https://www.npmjs.com/package/jang
- Repository: https://github.com/JosephUz/jang
- Homepage: https://github.com/JosephUz/jang#readme
- Issues: https://github.com/JosephUz/jang/issues
- npm.io page: https://npm.io/package/jang

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-11-15
- 1.0.1 — 2018-11-15
- 1.0.0 — 2018-11-14

## README

jang
==================

For client-side language text.


## Installation

```shell
$ npm install jang
```

## Usage

```html

<!-- html lang attribute default language -->

<!DOCTYPE html>
<html lang="tr">

<head>
    <meta charset="utf-8" />
</head>

<body>
    <jang text="language"></jang>
    <button id="changeBtn" jang="title:title;">
        <jang text="change.title"></jang>
    </button>

    <script src="./index.build.min.js"></script>
</body>

</html>

```

### index.js file

```javascript

const jang = require("jang");
const en = require('./locales/en.js');
const tr = require('./locales/tr.js');

jang.add('en', en);
jang.add([
    { name: 'tr', value: tr }
]);

// html lang attribute is default language or if it doesn't exist, first added language is default
jang.refresh();

jang.onChange(function (name, value) {
    console.log('current language: ' + name);
});

document.getElementById("changeBtn").addEventListener("click", function (e) {
    jang.set(jang.current == 'tr' ? 'en' : 'tr');
});

document.getElementById("addBtn").addEventListener("click", function (e) {
    var div = document.createElement('div');
    div.innerHTML = `<jang text="language"></jang> 
        <button jang="title:new.title;"> <jang text="new.title"></jang> </button>`;
    document.querySelector('body').append(div);
    jang.refresh();
});

```

### index.build.js file

index.build.js file is generated from index.js with libraries like browserify or babel or parcel or webpack.

### [Build Sample][]

[Build Sample]: https://github.com/JosephUz/jang/tree/master/gulpfile.js


### tr.js file

```javascript

module.exports = {
    title: "Türkçe",
}

```

### en.js file

```javascript

module.exports = {
    title: "Engilish",
}

```

## Examples

### [Basic Usage][]

This example shows the most basic way of usage.

[Basic Usage]: https://github.com/JosephUz/jang/tree/master/examples/basic/index.html


License
-------

This software is free to use under the JosephUz. See the [LICENSE file][] for license text and copyright information.


[LICENSE file]: https://github.com/JosephUz/jang/blob/master/LICENSE

---
_Source: https://npm.io/package/jang · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
