# marko-i18next

> Components to use i18next in Marko templates.

Latest version **0.2.1** (published 2017-08-21) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install marko-i18next
pnpm add marko-i18next
yarn add marko-i18next
bun add marko-i18next
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2017-08-21 |
| First published | 2016-11-18 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Niall Molloy |
| Maintainers | thac0 |
| Keywords | marko-taglib, marko, gov.uk, i18next |

## Links

- npm: https://www.npmjs.com/package/marko-i18next
- Repository: https://github.com/gunjam/marko-i18next
- Homepage: https://github.com/gunjam/marko-i18next#readme
- Issues: https://github.com/gunjam/marko-i18next/issues
- npm.io page: https://npm.io/package/marko-i18next

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 0.2.1 (latest) — 2017-08-21
- 0.2.0 — 2016-11-18

## README

# i18next Marko tag lib

This tag lib allows you to access the i18next `t()` function from your request
object (if for example you're using i18next Express middleware) in your
templates if streaming to a response using the `template.render()` function:

```javascript
template.render({}, res);
```

## Installing

```bash
npm install marko-i18next
```

## Usage

Example locales file (`namespace.json`):

```json
{
  "message": "Hi guys",
  "interpolatedMessage": "Hi {{name}}",
  "submit": "Submit form",
  "nameSubmit": "Submit form for {{name}}"
}
```

### `<i18n-message/>` component

In a Marko template:

```marko
<p>
  <i18n-message key="namespace:message"/>
</p>
```

With interpolated strings:

```marko
<p>
  <i18n-message key="namespace:interpolatedMessage" name="Hammond Eggs"/>
</p>
```

### `<i18n-var/>` compile time variable

You can also add the translation function to your template by including
`<i18n-var/>` at the top of the file. This is useful for assigning i18n
messages to attributes:

```marko
<i18n-var/>

<form>
  ...
  <input type="submit" value=i18n('namespace:submit')/>
</input>
```

With interpolated strings:

```marko
<i18n-var/>

<form>
  ...
  <input type="submit" value=i18n('namespace:nameSubmit', {name: 'George'})/>
</input>
```

## Contributing

Do a pull request, I'll have a look!

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