🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

g-lang

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

g-lang

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

latest
Source
npmnpm
Version
0.0.12
Version published
Weekly downloads
22
144.44%
Maintainers
1
Weekly downloads
 
Created
Source

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

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

import { lang, createObject } from 'g-lang'
const langs = createObject( function () {
    return {
        title: lang.title,
    }
})
console.log(langs.title)

FAQs

Package last updated on 16 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts