New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-langlate

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-langlate

Langlate is a React Component which makes multilingualism easier.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Langlate

React Component which makes multilingualism easier.

Install

  • Download package via npm i langlate
  • Import using var Langlate = require('langlate') or for ES6 import Langlate from 'langlate'

Usage

You can use langlate as a React Component or get the translation returned by the raw method as a string.

Component

<Langlate text={object} language={string} \>

Function

Langlate.raw(object text, string language);

Arguments
  • 'text' [object] contains language keys and corresponding translations. (e.g. { en_US: "Hello World" })
  • 'language' [string] is the language in which the translation will be returned. (e.g. "en_US")

Documentation & Demo

Can be found here - documentation and demo

Example

import React from "react";
import { render } from "react-dom";
import Langlate from "langlate";

class Demo extends React.Component {
  render() {
    /** Object containing translations. */
    const helloWorld = {
        en_US: "Hello World",
        pl_PL: "Witaj Świecie",
        de_DE: "Hallo Welt",
        es_ES: "Hola Mundo"
    };

    return (
        <h2>
          <Langlate language={"en_US"} text={helloWorld} />
        </h2>
    );
  }
}

render(<Demo />, document.getElementById("app"));

Give it a try on codesandbox.io

Build instructions

After cloning the repo, install all dependencies using npm install.

Run the development mode: npm run dev

Run just the docs: npm run docs

Run just the library: npm run lib

Deploy the production-ready docs: npm run docs:prod

Test the library: npm test

Keywords

language

FAQs

Package last updated on 01 Aug 2018

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