npm package: @poool/grunt-angular-translate-cache
Description: Grunt build task to concatenate & pre-load your Angular Translate translations using $translateCache
Author: Ugo Stephant
Latest version: 0.1.1
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# grunt-angular-translate-cache

> Grunt build task to concatenate &amp; pre-load your Angular Translate translations using $translationCache

Output example :

```javascript
angular.module('test-app').run(['$translationCache', function($translationCache) {
  $translationCache.put("languages/en.json", {"test":"This is a <span class=\"test\">test</span>"});
  $translationCache.put("languages/fr.json", {"test":"Ceci est un test"});
}]);
```

Then, when you use a translation file with `angular-translate-loader-static-files` it will already be loaded without having to do another Ajax request !

## Installation

This plugin requires [Grunt](http://gruntjs.com/) `~1.0.0`

Usemin integration requires [grunt-usemin](https://github.com/yeoman/grunt-usemin) `~3.0.0`

Install the plugin :
- NPM : `$ npm install @poool/grunt-angular-translate-cache --save-dev`
- Yarn : `$ yarn add @poool/grunt-angular-translate-cache`

Enable the plugin within your `Gruntfile` :

```js
grunt.loadNpmTasks("@poool/grunt-angular-translate-cache");
```


## Options

### angular

> Global namespace for Angular.

If you use `angular.noConflict()`, then set this value to whatever you
re-assign angular to.  Otherwise, it defaults to `angular`.

### bootstrap

> Callback to modify the bootstraper that registers lang files with `$translationCache`.

By default, the bootstrap script wraps `function($translationCache) { ... }` with:

```js
angular.module('app').run(['$translationCache', ... ]);
```

If you want to create your own wrapper so you register the templates as an
AMD or CommonJS module, set the `bootstrap` option to something like:

```js
bootstrap: function(module, script) {
  return 'module.exports[module] = ' + script + ';';
}
```

### module

> `String` of the `angular.module` to register templates with.

If not specified, it will automatically be the name of the `ngTranslateCache`
subtask (e.g. `app`, based on the examples below).

### prefix

> `String` to prefix template URLs with. Defaults to `''`

If you need to use absolute urls:

```js
ngTranslateCache: {
  app: {
    options: {
      prefix: '/'
    }
  }
}
```

If you serve static assets from another directory, you specify that as well.

### standalone

> Boolean indicated if the templates are part of an existing module or a standalone. Defaults to `false`.

- If the value is `false`, the module will look like `angular.module('app')`, meaning `app` module is retrieved.
- If the value is `true`, the module will look like `angular.module('app', [])`, meaning `app` module is created.

### usemin

> Path to `<!-- build:js [path/to/output.js] -->` usemin target

This should be the output path of the compiled JS indicated in your HTML,
such as `path/to/output.js` shown here.


## Example

```js
ngTranslateCache: {
    options: {
        module: "app",
        usemin: "scripts/scripts.js"
    },
    app: {
        cwd: "app",
        src: "languages/**/*.json",
        dest: "build/translateCache.js"
    }
}
```


## Contributing

Feel free to contribute to this repository by making pull requests to http://github.com/p3ol/grunt-angular-translate-cache and create any related issue on the same github repository.


## License

Copyright (c) 2017 Ugo Stephant. Licensed under MIT license.