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

react-g-lang

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-g-lang

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

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
1
-92.86%
Maintainers
1
Weekly downloads
 
Created
Source

install

npm install react-g-lang

react or react-native example

import React from 'react';
import { SafeAreaView, Text,TouchableOpacity } from 'react-native';

// required
import { setLanguages, setLanguage, createObject } from 'g-lang'
import LangReloader, { lang } from 'react-g-lang'


// './languages' must be the same path as './node_modules'
// Please download 'https://github.com/lendland/g-lang/raw/master/g-lang-example.zip' and refer to directory/file structure.
setLanguages({
    en: require('./languages/en'),
    kor: require('./languages/default'),
})

const langObject = createObject(function (){
    return {
        content: lang.content
    }
})

class App extends React.Component {
    render(){
        return (
            <SafeAreaView style={{ flex: 1 }}>

            <TouchableOpacity style={{ padding:20 }} onPress={()=>{
            setLanguage('en')
            }}>
            <Text>to EN</Text>
            </TouchableOpacity>
            <TouchableOpacity style={{ padding:20 }} onPress={()=>{
            setLanguage('kor')
            }}>
            <Text>to KOR</Text>
            </TouchableOpacity>

            <Text>{lang.title}</Text>
            <Text>{langObject.content}</Text>
            </SafeAreaView>
        )
    }
};

// Be sure to wrap your app with LangReloader.
export default LangReloader(App);

DOC

https://github.com/lendland/g-lang

FAQs

Package last updated on 10 Sep 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