# g-lang

> Multi Language Module / 가장 편리한 다국어 모듈(자동완성 지원)

Latest version **0.0.12** (published 2019-07-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install g-lang
pnpm add g-lang
yarn add g-lang
bun add g-lang
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.12 |
| Published | 2019-07-16 |
| First published | 2019-07-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | JaeWan, Ryu |
| Maintainers | lendland |

## Links

- npm: https://www.npmjs.com/package/g-lang
- Repository: https://github.com/lingobong/g-lang
- Issues: https://github.com/lingobong/g-lang/issues
- npm.io page: https://npm.io/package/g-lang

## Recent versions

- 0.0.12 (latest) — 2019-07-16
- 0.0.11 — 2019-07-16
- 0.0.10 — 2019-07-16
- 0.0.9 — 2019-07-06
- 0.0.8 — 2019-07-06
- 0.0.7 — 2019-07-06
- 0.0.6 — 2019-07-05
- 0.0.5 — 2019-07-05
- 0.0.4 — 2019-07-05
- 0.0.3 — 2019-07-05
- 0.0.2 — 2019-07-05

## README

# G-Lang
+ You need to create a `./languages` folder in the same path as `./node_modules.`
+ You must create a `default.js` file in `./languages`.
    + `g-lang` supports autocompletion in vs code.
+ Click [Download Example ZIP] below to see the structure
---
+ `./node_modules.`와 같은 경로에 `./languages` 폴더를 생성해야합니다.
+ `./languages` 폴더에는 반드시 `default.js`(기본 언어) 파일을 생성해야합니다.
+ 아래의 [Download Example ZIP]을 클릭하여 구조를 확인하세요.

# install
```
npm install g-lang
```

# example : [Download Example ZIP](https://github.com/lendland/g-lang/raw/master/g-lang-example.zip)
```js
const { lang, getLanguage, setLanguage, setLanguages, onChangeLanguage } = require('g-lang');

setLanguages({
    en: require('./languages/default'),
    kor: require('./languages/kor')
})

onChangeLanguage(function (nextLang, prevLang) {
    console.log('lang changed !!', `${nextLang} => ${prevLang}`)
})
// .remove() // This code will remove the event listener above.(위 이벤트 리스너를 제거하는 코드입니다.)

// Download the 'Download Example ZIP' above and see the folder and JS file structure.
setLanguage('kor')
console.log(getLanguage(), lang.channel.name_label)
console.log(getLanguage(), lang.video.title)

setLanguage('en')
console.log(getLanguage(), lang.channel.name_label)
console.log(getLanguage(), lang.video.title)
```

## on global object
#### usage
```js
import { lang, createObject } from 'g-lang'
const langs = createObject( function () {
    return {
        title: lang.title,
    }
})
console.log(langs.title)
```

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