# @brimstone/react

> A simple React translation library.

Latest version **0.1.3** (published 2022-07-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @brimstone/react
pnpm add @brimstone/react
yarn add @brimstone/react
bun add @brimstone/react
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2022-07-03 |
| First published | 2022-07-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 921 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Matthew Downs |
| Maintainers | matthewdowns |

## Links

- npm: https://www.npmjs.com/package/@brimstone/react
- Repository: https://github.com/brimstone-js/brimstone
- Homepage: https://github.com/brimstone-js/brimstone#readme
- Issues: https://github.com/brimstone-js/brimstone/issues
- npm.io page: https://npm.io/package/@brimstone/react

## Dependencies (1)

- [react](https://npm.io/package/react.md) ^18.2.0

## Recent versions

- 0.1.3 (latest) — 2022-07-03
- 0.1.2 — 2022-07-03
- 0.1.1 — 2022-07-03
- 0.1.0 — 2022-07-03

## README

# Brimstone

A simple React translation library.

![GitHub package.json version](https://img.shields.io/github/package-json/v/brimstone-js/brimstone?label=Version)
[![Node.js CI](https://github.com/brimstone-js/brimstone/actions/workflows/node.js.yml/badge.svg)](https://github.com/brimstone-js/brimstone/actions/workflows/node.js.yml)
[![CodeQL](https://github.com/brimstone-js/brimstone/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/brimstone-js/brimstone/actions/workflows/codeql-analysis.yml)

[![JavaScript Style Guide](https://cdn.rawgit.com/standard/standard/master/badge.svg)](https://github.com/standard/standard)




## Introduction

Brimstone is an easy-to-use translation library that uses React context to change text across your entire app when the language is changed.




## Usage

Place the TranslationContext at the root of your application

```tsx
import { Language, TranslationContext } from '@brimstone/react'
import { useState } from 'react'

function App() {
  const [language, setLanguage] = useState<Language>()

  return (
    <TranslationContext.Provider value={{
      language,
      setLanguage
    }}>
      ...
    </TranslationContext>
  )
}
```

Use the Translate component anywhere to render the current language

```tsx
import { Translate } from '@brimstone/react'

function MyComponent() {
  return (
    <div>
      <h1>
        <Translate
          eng="Welcome to my website!"
          spa="¡Bienvenido a mi sito web!"
          deu="Willkommen in meiner Website!"
        />
      </h1>
    </div>
  )
}
```

### Demo

View a live demo [here](https://brimstone-js.github.io/brimstone/)




## Development

### Requirements

* [Node.js](https://nodejs.org)

### NPM Scripts

Run `npm install` first to install package dependencies.

* `npm run lint` - Run the StandardJS linter to check for warnings and errors
* `npm run build` - Build the library to the _dist_ folder
* `npm test` - Run the Jest testing suite




## License

Distributed under the MIT License. See [LICENSE](https://github.com/brimstone-js/brimstone/tree/main/LICENSE) for more information.

---
_Source: https://npm.io/package/@brimstone/react · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
