react-jed

React component for Jed

Usage no npm install needed!

<script type="module">
  import reactJed from 'https://cdn.skypack.dev/react-jed';
</script>

README

React Jed

React component for translation with Jed.

Installation

$ npm install --save react-jed

Usage

Simple translation

import Trans from 'react-jed'

class MyComponent extend React.Component {
    render() {
        var translations = window.translations
        return (
            <Trans trans={translations}>Christian Bale has an apple</Trans>
        )
    }
}

Complex translation with plural

import Trans from 'react-jed'

class MyComponent extend React.Component {
    render() {
        var nbr = 1,
            translations = window.translations

        return (
            <Trans
                count={nbr}
                one="{username} has one apple"
                plural="{username} has {nbr} apples"
                none="{username} has no apples"
                trans={translations}
            />
        )
    }
}