# juclientlang

> For client-side language text

Latest version **1.0.4** (published 2018-11-03) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-11-03 |
| First published | 2018-10-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | JosephUz |
| Maintainers | josephuz |
| Keywords | client-side, language |

## Links

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

## 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.4 (latest) — 2018-11-03
- 1.0.3 — 2018-10-29
- 1.0.2 — 2018-10-29
- 1.0.1 — 2018-10-29
- 1.0.0 — 2018-10-23

## README

ju Client Language
==================

For client-side language text.


## Installation

```shell
$ npm install juclientlang
```

## Usage

### Example File Tree

```html
├── node_modules
│ ├── juclientlang
├── page.build.js
├── locales
│ ├── tr.js
│ └── en.js
├── page.html
└── page.js
```

### page.html file

```html

<!-- lang attribute is required! --> 
<!DOCTYPE html>
<html lang="tr">

<head>
    <meta charset="utf-8" />
</head>

<body>
    <julang text="language"></julang>
    <button id="changeBtn" julang="title:title;">
        <julang text="title"></julang>
    </button>

    <script src="./page.build.js"></script>
</body>

</html>

```

### page.js file

```javascript

const juLang = require("juclientlang");

const langPath = './locales';

juLang(langPath)
    .then(function () {
        console.log("language loaded.");
    }).catch(function (err) {
        console.log(err.message);
    });

document.addEventListener("juLangChanged", function (e) {
    console.log(e.detail);
});

document.getElementById("changeBtn").addEventListener("click", function (e) {
    var html = document.getElementsByTagName("html")[0];
    if (html.attributes.lang.value == "en")
        html.setAttribute("lang", "tr");
    else
        html.setAttribute("lang", "en");
});

```

### page.build.js file

page.build.js file is generated from page.js with libraries like browserify or babel or parcel or webpack.

### [Building Sample][]

[Building Sample]: https://github.com/JosephUz/juClientLang/tree/master/gulpfile.js


### tr.js file

```javascript

var juLangObject = {
    language: "Türkçe",
    title: "Değiştir"
}

```


### Methods


#### `juLang(languageScriptPath)`

With the return of the Promise object, you can capture the completion of the process and errors.

**Parameters:**

* `languageScriptPath`: Path of language javascript files.



#### `juLangChanged Event`

If you want to catch events after each change, use 
```javascript
document.addEventListener("juLangChanged", function handle(e) { ... }) 
``` 

**handle Function Parameters:**

* `e.detail`: Event result.


## Examples

### [Basic Usage][]

This example shows the most basic way of usage.

[Basic Usage]: https://github.com/JosephUz/juClientLang/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/juClientLang/blob/master/LICENSE

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