Code Monkey home page Code Monkey logo

react-html-i18n's Introduction

react-html-i18n

  • ICU message format.
  • Argument values can be React elements.
  • Full HTML support (including attributes).
  • Custom argument formatters.
  • Custom HTML tags and tag overrides.
  • Server-side rendering (SSR) compatible.
  • Fast and lightweight!

Install

$ yarn add react-html-i18n
$ npm install react-html-i18n

Motivation

No other translation library (that I’m aware of) supports both HTML and React elements in the same message.

Some libraries support custom tags, like this:

Hello, <tag>{name}</tag>.

However, it’s not really HTML, as translators can’t add attributes, and each tag must have its behavior defined by the programmer. If you only need basic rich text features like bold and italics, that might be good enough. But what if the translator wants to control the href of a link, or add inline style to an element?

If you have an existing collection of translation strings containing HTML, you’re out of luck with most i18n libraries. At best, the ones that support HTML (like old versions of react-intl) only allow substitution of primitive values. This library supports substitution of any value that React can render – including React elements!

react-html-i18n's People

Contributors

exogen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.