# generate-transifex-config

> Script to generate a Transifex config file for a project, used by command line client.

Latest version **1.0.2** (published 2018-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install generate-transifex-config
pnpm add generate-transifex-config
yarn add generate-transifex-config
bun add generate-transifex-config
```

## 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.2 |
| Published | 2018-08-22 |
| First published | 2017-11-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 16.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | VoxFeed |
| Maintainers | manuelmhtr, voxfeed |
| Keywords | transifex, config, languages, cli, client, voxfeed |

## Links

- npm: https://www.npmjs.com/package/generate-transifex-config
- Repository: https://github.com/VoxFeed/generate-transifex-config
- Homepage: https://github.com/VoxFeed/generate-transifex-config#readme
- Issues: https://github.com/VoxFeed/generate-transifex-config/issues
- npm.io page: https://npm.io/package/generate-transifex-config

## Dependencies (1)

- [app-root-path](https://npm.io/package/app-root-path.md) ^2.0.1

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-08-22
- 1.0.1 — 2017-11-29
- 1.0.0 — 2017-11-29

## README

# Generate [Transifex](https://www.transifex.com/) config

This module generates a Transifex CLI client config file (.tx/config) for a whole project.

Usually there’s need to run a client command for each file or add them to `.tx/config` manually, one by one. This project makes it easier for projects with multiple language files.

See [Transifex command line client](https://docs.transifex.com/client/introduction) to learn more of this feature.


### Installation

```
npm install --save-dev generate-transifex-config
```

### Usage

This module exports a function that receives an object with parameters:

| Parameter  | Type | Description |
| ------------- | ------------- | ----------------- |
| projectName  | string | Is the url name from the Transifex project to be updated. |
| sourceLocale | string | The locale (language) of your source files. |
| sourcePath | string | The path to the folder where all **source** language files are located. |
| destinationPath | string | The path to the file where config will be stored (a file with the same name will be overwritten). |
| main | object | An object containg all configuration for the "main" block (needed by Transifex client). |
| fileTypes | array | An array with configuration for each file type. |
| fileTypes.extension | string | The extension that will filter the files to apply this configuration. |
| fileTypes.type | string | The Transifex type for the files matching the extension (see Transifex docs). |

### Example

Given a project where language files are organized as following:

```
i18n/
  |-en/
  |  |-file1.json
  |  |-file2.json
  |  \-subfolder
  |     \-file3.md
  \-es/
    ...
```

The module can be used like this:

```javascript
const generateTransifexConfig = require('generate-transifex-config');

const params = {
  projectName: 'my-project',
  sourceLocale: 'en',
  sourcePath: '/my-project/i18n/en/',
  destinationPath: '/my-project/.tx/config',
  main: {
    host: 'https://www.transifex.com'
  },
  fileTypes: [
    {
      extension: 'json',
      type: 'KEYVALUEJSON'
    },
    {
      extension: 'md',
      type: 'MARKDOWN'
    }
  ]
};

generateTransifexConfig(params);
```

This will generate the file `/my-project/.tx/config`, containing:

```
[main]
host = https://www.transifex.com

[my-project.file1-json]
source_lang = en
source_file = i18n/es/file1.json
file_filter = i18n/<lang>/file1.json
type = KEYVALUEJSON

[my-project.file2-json]
source_lang = en
source_file = i18n/es/file2.json
file_filter = i18n/<lang>/file2.json
type = KEYVALUEJSON

[my-project.subfolder-file3-md]
source_lang = en
source_file = i18n/es/subfolder/file3.md
file_filter = i18n/<lang>/subfolder/file3.md
type = MARKDOWN
```

💡 **Pro-tip:** You can create a file `generate-config.js` in .tx folder with the required parameters and a call to this module. That way anybody in your team just need to run:

```
node .tx/generate-config.js
```

...and the `.tx/config` file will be updated.

### Testing

```
npm test
```

### Contribution

Anybody is welcome to contribute. Just please follow the rules:

- Stick to the same code style.
- Include enough tests.
- Update README if necessary.

### License

MIT

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