# translator-helper-dustjs

> A simple helper for dustJs to load dynamic translations, based on https://github.com/mikesparr/Kraken_Example_i18n_Helper

Latest version **2.0.5** (published 2016-05-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install translator-helper-dustjs
pnpm add translator-helper-dustjs
yarn add translator-helper-dustjs
bun add translator-helper-dustjs
```

## 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 | 2.0.5 |
| Published | 2016-05-18 |
| First published | 2015-03-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Daniel Biedma |
| Maintainers | danibram |
| Keywords | translator, helper, dustjs, dynamic, translations |

## Links

- npm: https://www.npmjs.com/package/translator-helper-dustjs
- Repository: https://github.com/danibram/translator-helper-dustjs
- Issues: https://github.com/danibram/translator-helper-dustjs/issues
- npm.io page: https://npm.io/package/translator-helper-dustjs

## Dependencies (1)

- [file-resolver](https://npm.io/package/file-resolver.md) ~1.0.2

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 2.0.5 (latest) — 2016-05-18
- 2.0.4 — 2016-05-18
- 2.0.3 — 2016-05-18
- 2.0.2 — 2016-05-18
- 2.0.1 — 2016-05-18
- 2.0.0 — 2016-05-11
- 1.0.1 — 2015-03-17
- 1.0.0 — 2015-03-17

## README

# translator-helper-dustjs  [![Dependency Status](https://david-dm.org/danibram/translator-helper-dustjs.svg)](https://david-dm.org/danibram/translator-helper-dustjs)

A little helper for dustjs to load i18n translations dynamically, with variables, based on https://github.com/mikesparr/Kraken_Example_i18n_Helper. Feel free to comment, copy or burn this code =P

### New version supporting kraken 2. Check the 1.x for kraken 1 and 2.x for kraken 2.

## Getting Started
Install the module with: `npm install translator-helper-dustjs`

Its important to add a global variable to pass the kraken config to the module, i put in my index.js this after load kraken config
```javascript
/* ... */
app = module.exports = express();
app.use(kraken(options));
global._app = app;
/* ... */
```

##### KrakenJs 2

```javascript
/* ... */
//In your config file, using tag 2.x
    "dust": {
        "helpers": [
            "dust-makara-helpers",
            "translator-helper-dustjs"
        ]
    },
/* ... */
```

##### KrakenJs 1

```javascript
/* ... */
// On your controllers file or wethever you load dust, add the helper like another, using tag 1.x
var dust = require('dustjs-linkedin');
require('dustjs-helpers');
require('translator-helper-dustjs');
/* ... */
```


## Examples
On your properties files (index.properties)
```javascript
/* ... */
jobs.acme.title=Company Acme
jobs.hernes.title=Company Hernes
/* ... */
```

On your dust template files, pass to the t helper the key (jobs.acme.title -> companyName = "acme"), the properties file (index in this case), and the lang (in my case "EN_us")
```javascript
/* ... */
{@t key="jobs.{companyName}.title" bundle="index" lang="{lang}" /}
/* ... */
```
And the result will be
```javascript
/* ... */
Company Acme
/* ... */
```

## Contributing
Please fell free to contribute, i´m not a real expert of dustJs

## Release History
###(2.x)

- Supporting krakenJs 2

###(1.x)

- Supporting krakenJs 1

## License
Copyright (c) 2015 Daniel Biedma Ramos
Licensed under the MIT license.

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