# @openremote/or-translate

> Provides a web component for translations using i18next

Latest version **1.30.0** (published 2026-09-02) · AGPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @openremote/or-translate
pnpm add @openremote/or-translate
yarn add @openremote/or-translate
bun add @openremote/or-translate
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.30.0 |
| Published | 2026-09-02 |
| First published | 2020-09-08 |
| Weekly downloads | 0 |
| License | AGPL-3.0-or-later |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 182.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1907 |
| Author | OpenRemote |
| Maintainers | openremotedeveloper, wborn |

## Links

- npm: https://www.npmjs.com/package/@openremote/or-translate
- Repository: https://github.com/openremote/openremote
- npm.io page: https://npm.io/package/@openremote/or-translate

## Dependencies (3)

- [lit](https://npm.io/package/lit.md) ^3.3.1
- [i18next](https://npm.io/package/i18next.md) ^21.5.3
- [@openremote/or-element](https://npm.io/package/@openremote/or-element.md) 1.30.0

## Recent versions

- 1.30.0 (latest) — 2026-09-02
- 1.31.0-snapshot.20260916144308 (snapshot) — 2026-09-16
- 1.31.0-snapshot.20260916130646 — 2026-09-16
- 1.31.0-snapshot.20260915122244 — 2026-09-15
- 1.31.0-snapshot.20260911091633 — 2026-09-11
- 1.31.0-snapshot.20260910125057 — 2026-09-10
- 1.31.0-snapshot.20260910120754 — 2026-09-10
- 1.31.0-snapshot.20260908130403 — 2026-09-08
- 1.31.0-snapshot.20260907094218 — 2026-09-07
- 1.31.0-snapshot.20260904133325 — 2026-09-04
- 1.31.0-snapshot.20260904115341 — 2026-09-04
- 1.31.0-snapshot.20260904102436 — 2026-09-04
- 1.31.0-snapshot.20260903144735 — 2026-09-03
- 1.31.0-snapshot.20260903142507 — 2026-09-03
- 1.31.0-snapshot.20260903135821 — 2026-09-03
- … 812 more at https://npm.io/package/@openremote/or-translate/versions

## README

# @openremote/or-translate \<or-translate\>

[![NPM Version][npm-image]][npm-url]

Web Component for displaying a translated string based on the `18next` library.

## Install

```bash
npm i @openremote/or-translate
yarn add @openremote/or-translate
```

## Usage

For a full list of properties, methods and options refer to the TypeDoc generated [documentation](<>).

For a full list of `i18next` functionality refer to that project's [documentation](https://www.i18next.com/).

If used in conjunction with `@openremote/core` and the `Manager` `init` method has been called then the `i18next`
default export will be ready to use and would have been configured with the following settings:

- Language: `en`
- Fallback language: `en`
- Default Namespace: `app`
- Fallback namespace: `or`
- Available namespaces: `ManagerConfig.loadTranslations`
- OR Namespace path: `managerURL` + `/shared/locales/{{lng}}/{{ns}}.json`
- Namespace path: `ManagerConfig.loadTranslations` or fallback to `locales/{{lng}}/{{ns}}.json`

There is an `or` namespace which is used for OpenRemote related translations; apps can use any other namespace(s) it is
recommended to use `app` as this is set as the default as described above. To translate a string use the following HTML:

```$html
<or-translate value="app:asset" />
```

If using the default namespace then the namespace prefix can be omitted:

```$html
<or-translate value="asset" />
```

It is also possible to pass an `TOptions<InitOptions>` object to the `18next.t` method by setting the
`options` attribute.

### Translate mixin (`dist/translate-mixin`)

Exports a `translate` function/mixin that can be used by any web component to hook into the `i18next` `initialized` and
`languageChanged` events; if the web component is a `LitElement` an update of the component will be automatically
requested when either event fires; otherwise the `initCallback` and/or `langChangedCallback` should be overridden as
required. For usage example see the [or-translate source code](./src/index.ts).

## Supported Browsers

The last 2 versions of all modern browsers are supported, including Chrome, Safari, Opera, Firefox, Edge. In addition,
Internet Explorer 11 is also supported.

## License

[GNU AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)

[npm-image]: https://img.shields.io/npm/v/@openremote/or-translate.svg
[npm-url]: https://www.npmjs.com/package/@openremote/or-translate

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