# i18n-table

> A React component that helps organize and manage translations

Latest version **1.0.5** (published 2024-02-25) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install i18n-table
pnpm add i18n-table
yarn add i18n-table
bun add i18n-table
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2024-02-25 |
| First published | 2023-10-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 102.6 KB |
| Known vulnerabilities | 0 (+6 in 2 direct dependencies) |
| Install scripts | no |
| Maintainers | piotrpospiech |
| Keywords | i18n, manager, react-component, table, translations |

## Links

- npm: https://www.npmjs.com/package/i18n-table
- npm.io page: https://npm.io/package/i18n-table

## Dependencies (7)

- [js-yaml](https://npm.io/package/js-yaml.md) 4.1.0
- [file-saver](https://npm.io/package/file-saver.md) 2.0.5
- [lodash.get](https://npm.io/package/lodash.get.md) 4.4.2
- [lodash.set](https://npm.io/package/lodash.set.md) 4.3.2
- [react-virtuoso](https://npm.io/package/react-virtuoso.md) 4.5.1
- [lodash.clonedeep](https://npm.io/package/lodash.clonedeep.md) 4.5.0
- [lodash.escaperegexp](https://npm.io/package/lodash.escaperegexp.md) 4.1.2

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2024-02-25
- 1.0.4 — 2024-01-30
- 1.0.3 — 2023-12-23
- 1.0.2 — 2023-10-27
- 1.0.1 — 2023-10-10
- 1.0.0 — 2023-10-09

## README

<h1 align="center">i18n-table</h1>

<p align="center">
  <a href="https://github.com/vazco/i18n-table/blob/master/LICENSE">
    <img src="https://img.shields.io/github/license/vazco/i18n-table" alt="MIT license" />
  </a>
  <a href="https://vazco.eu">
    <img src="https://img.shields.io/badge/vazco-package-blue.svg" alt="Vazco">
  </a>
  <a href="https://npmjs.org/package/i18n-table">
    <img src="https://img.shields.io/npm/v/i18n-table.svg" alt="NPM version" />
  </a>
</p>

## Installation

```
npm install i18n-table
```

## Get started

1. Import `TranslationManager` and styles

```js
import TranslationManager from "i18n-table";
import "i18n-table/dist/index.css";
```

2. Prepare translations

```js
const translations = {
  en: {
    colors: {
      red: "Red",
      blue: "Blue",
      green: "Green",
    },
  },
  es: {
    colors: {
      red: "Rojo",
      green: "Verde",
    },
  },
};
```

`translations` object should have **locales** as keys and **objects or nested objects** as values.

3. Prepare locales with full and local names.

> [!IMPORTANT]
> The `locale` property have to match with locale used in the first step.

```js
const locales = [
  { locale: "en", fullName: "English", localName: "English" },
  { locale: "es", fullName: "Spanish", localName: "Español" },
];
```

4. Render `TranslationManager` on your page

```jsx
export const App = () => {
  const onSave = (translation) => {
    /* Handle saving translations - structure is the same as in the step 2. */
  };

  return <TranslationManager translations={translations} locales={locales} onSave={onSave} />;
};
```

5. If you want to write **your own styles**, copy `/src/lib/styles.css` file to your project, modify it and import it instead of `i18n-table/dist/index.css`

6. You can also customize header translations.

```jsx
const componentTranslations = {
  save: t("save"),
  search: t("search"),
  select: t("select"),
  translationKey: t("translationKey"),
};

export const App = () => {
  const onLocaleChange = (locale) => i18n.setLocale(locale);

  return (
  <TranslationManager
    {/* ... */}
    componentTranslations={componentTranslations}
    onLocaleChange={onLocaleChange}
  />
)
};
```

## License

**Like every package maintained by [Vazco](https://vazco.eu/), i18n-table package is [MIT licensed](https://github.com/vazco/i18n-table/blob/master/LICENSE).**

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