BKJang / react-multilang-translate

πŸ“ Module that provides an easy way to translate into your preferred language in React.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-multilang-translate

GitHub license

Features

  • Translate with message object
  • Mutiline translate
  • Implementation with React
  • Usage with Redux is recommended
  • Decorate the style with props.

Installation

yarn add react-multilang-translate

or

npm install --save react-multilang-translate

Import

// at the top of your app
import { Translator } from "react-multilang-translate"

Usage

//message.js
export const MESSAGE = {
    en_US : {
        example_say_hello : 'Hello'
    },
    ko_KR : {
        example_say_hello : 'μ•ˆλ…•ν•˜μ„Έμš”'
    }
}
import React, { Component } from 'react';
import { Translator } from 'react-multilang-translate';
import { MESSAGE } from './message';

class Example extends Component {
  render() {
    return (
      <Translator
        transKey='example_say_hello'
        locale='en_US'
        messageObj={MESSAGE}
      />
    );
  }
}
git clone https://github.com/BKJang/react-multilang-translate.git
cd react-multilang-translate/example
npm install
npm start

Copyright and License

MIT License

Copyright (c) 2019 BKJang(PaulJ)

About

πŸ“ Module that provides an easy way to translate into your preferred language in React.

License:MIT License


Languages

Language:JavaScript 98.1%Language:HTML 1.9%