# t-component

> tiny translation helper

Latest version **1.0.0** (published 2014-01-16) · 0 weekly downloads

## Install

```sh
npm install t-component
pnpm add t-component
yarn add t-component
bun add t-component
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2014-01-16 |
| First published | 2012-09-12 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Maintainers | tjholowaychuk |

## Links

- npm: https://www.npmjs.com/package/t-component
- Repository: https://github.com/component/t
- Issues: https://github.com/component/t/issues
- npm.io page: https://npm.io/package/t-component

## Recent versions

- 1.0.0 (latest) — 2014-01-16
- 0.0.1 — 2012-09-12

## README

# t

  tiny translation helper.

## Installation

    $ component install component/t

## API

### t(string, [object], [lang])

  Return a translatable `string`, with optional
  substitutions keyed in `object` using language `lang`.

```js
var t = require('t');

t('Hello');
// => "Hello"

t('Hello {name}', { name: 'Tobi' });
// => "Hello Tobi"
```

### t.lang()

  Get the current language code, for example "en".

### t.lang(code)

  Set language `code`.

### t.CODE = object

  Define translations, for example:

```js
t.es = {
  'Hello {name}': 'Hola {name}'
};

t('Hello {name}', { name: 'Tobi' });
// => "Hello Tobi"

t.lang('es');
t('Hello {name}', { name: 'Tobi' }).should.equal('Hola Tobi');
// => "Hola Tobi"
```

# License

  MIT

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