Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/freaktechnik/transifex-loader

A loader, that fetches the content of string files from transifex.
https://github.com/freaktechnik/transifex-loader

i18n internationalization l10n loader localization transifex webpack-loader

Last synced: 11 days ago
JSON representation

A loader, that fetches the content of string files from transifex.

Awesome Lists containing this project

README

        

# transifex-loader

[![codecov](https://codecov.io/gh/freaktechnik/transifex-loader/graph/badge.svg?token=DBYp5Rht9J)](https://codecov.io/gh/freaktechnik/transifex-loader)

A loader, that fetches the content of string files from Transifex. Requires
configuration via `.transifexrc` and `.tx/config` in the same format as the
official `tx` tool. The configuration files are searched from the directory
the loaded file is in up to the system root.

## Installation

```bash
npm install --save-dev transifex-loader
```

## Usage

Add the loader before any other action in your webpack configuration for all your
resources that are translated on Transifex. You can of course also use it in a
require statement directly. The loader works as a kind of pre-processor for
translations.

If the translation can be found on Transifex, it is downloaded and
returned. If an error occurs (i.e. no internet connection) the local file is
returned. When the remote translations are successfully loaded the loader by
default writes the updated version to disk, replacing your local file. This can
be disabled with the `store` option.

To match your local resources with the Transifex translations the loader uses
the same configuration as the `tx` command line tool, specifically `.transifexrc`
for credentials and `.tx/config` for resource informations.

## Options

### `store`

You can disable writing the result from Transifex to the original file by setting
this to `false`.

### `disableCache`

Disables reading the resource that is in the source language from the local file
system and fetches it from Transifex, too.

## Known incompatibilities (to tx)

- Requires the project to be on transifex.com but does not complain about it.
- Ignores `minimum_perc`.