# gulp-csv-angular-translate

> Gulp plugin for generating multiple language JSON files out of one CSV File.

Latest version **0.0.5** (published 2017-08-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-csv-angular-translate
pnpm add gulp-csv-angular-translate
yarn add gulp-csv-angular-translate
bun add gulp-csv-angular-translate
```

## 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.0.5 |
| Published | 2017-08-14 |
| First published | 2016-02-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | antikalk |
| Maintainers | antikalk |
| Keywords | gulpplugin |

## Links

- npm: https://www.npmjs.com/package/gulp-csv-angular-translate
- Repository: https://github.com/antikalk/gulp-csv-angular-translate
- Homepage: https://github.com/antikalk/gulp-csv-angular-translate#readme
- Issues: https://github.com/antikalk/gulp-csv-angular-translate/issues
- npm.io page: https://npm.io/package/gulp-csv-angular-translate

## Dependencies (6)

- [del](https://npm.io/package/del.md) ^2.2.0
- [gulp](https://npm.io/package/gulp.md) ^3.9.0
- [through2](https://npm.io/package/through2.md) ^2.0.0
- [csv-parse](https://npm.io/package/csv-parse.md) ^1.0.1
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.7
- [gulp-debug](https://npm.io/package/gulp-debug.md) ^2.1.2

## Recent versions

- 0.0.5 (latest) — 2017-08-14
- 0.0.4 — 2016-06-05
- 0.0.3-beta — 2016-02-02
- 0.0.3 — 2016-02-02

## README

# gulp-csv-angular-translate (gCat)
Gulp plugin for generating multiple language JSON files out of one CSV File.

## What's it for?
When using angular-translate with [asynch loading](https://github.com/angular-translate/angular-translate/wiki/Asynchronous-loading) and splitted language files for minimizing the network traffic, writing the different JSON-Files can be confusing.

This Plugin provides a simple way of translating the different languages in only one .csv-File and generating the needed .json-Files.

The .csv-File:

Key | de_DE | en_US | en_UK
------------ | ------------- | ------------- | -------------
HELLO | Hallo | Hello | Hello
WORLD | Welt | World | World

Results in the three .json-Files: de_DE.json, en_US.json, en_UK.json

de_DE.json:
`{"HELLO":"Hallo","WORLD":"Welt"}`

en_US.json:
`{"HELLO":"Hello","WORLD":"World"}`

en_UK.json:
`{"HELLO":"Hello","WORLD":"World"}`

## How to use the plugin

Install the plugin:

`npm install --save gulp-csv-angular-translate`

Write the gulp task:

```javascript
var gCat = require('gulp-csv-angular-translate');
gulp.task('lang', function() {
     gulp.src('lang.csv') //language source .csv
         .pipe(gCat()) //run the plugin
         .pipe(gulp.dest('build')); //put out the .json-files in a specified folder
});
```

## Configurations

#### Configure the csv-parser options

The options for the csv parser can be configured under `csvParserOptions`. Find the possible configurations [here](http://csv.adaltas.com/parse/).

Example:

```javascript
gulp.task('lang', function() {
    gulp.src('lang.csv')
        .pipe(gCat({
            csvParseOptions: {
                delimiter: ';',
                trim: true
            }
        }))
        .pipe(gulp.dest('build'));
});
```

#### Skip empty translations

The option `skipEmptyTranslations` always empty translations to be skipped. This means that empty columns don't result in an empty translation string.

Example: 

```javascript
gulp.task('lang', function() {
    gulp.src('lang.csv')
        .pipe(gCat({
            skipEmptyTranslations: true
        }))
        .pipe(gulp.dest('build'));
});
```

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