react-i18n-map

a simple react component that maps translation object to a string literal

Usage no npm install needed!

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

README

react-i18n-map

a simple react component that maps translation object to a string literal

Travis npm codecov

Getting Started

This is attempt for transitioning an app using react 0.13.3 to react 15.x.x. We were using react-intl v1 before and wanted to simplify transition and just copied the public api for FormatMessage and FormatHTMLMessage. We were getting a lot of warnings due to our upgrade from v1 to v2.

So we copied the basic functionality of FormattedMessage and FormattedHTMLMessage from react-intl and we found out we could greatly simplify this just wrote this from scratch.

Basic usage:

<FormattedMessage message="Hello World" />

Interpolation:

<FormattedMessage message="This is {foo} and this is {bar}" values={ foo: 1, bar: 2 } />

With html

<FormattedHTMLMessage message="This is {foo} <em>and</em> this is {bar}" values={ foo: 1, bar: 2 } />

Prerequisites

Using this module requires React and is added as peer dependencies. It means you need to manually add react since installing this library won't install react for you. So you need to do this before consuming this module:

npm install react --save

or

yarn add react

Installing

via npm

npm install react-i18n-map --save

via yarn

yarn add react-i18n-map

Built With

  • React - A javascript library for building User Interfaces

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • Hat tip to ericf for react-intl, our initial library of choice.