# i18n-squish

> Watch and compile language files into single locales ready to be served to angular-translate using angular-translate-loader-url.

Latest version **1.0.1** (published 2015-01-23) · GNU GPL license · 0 weekly downloads

## Install

```sh
npm install i18n-squish
pnpm add i18n-squish
yarn add i18n-squish
bun add i18n-squish
```

## 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.1 |
| Published | 2015-01-23 |
| First published | 2015-01-23 |
| Weekly downloads | 0 |
| License | GNU GPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Sam Gluck |
| Maintainers | sdgluck |
| Keywords | i18n, internationalisation, locale, language, lang, angular-translate, angular-translate-loader-url, express, node, watch, node-watch, compile |

## Links

- npm: https://www.npmjs.com/package/i18n-squish
- Repository: https://github.com/sdgluck/i18n-squish
- Issues: https://github.com/sdgluck/i18n-squish/issues
- npm.io page: https://npm.io/package/i18n-squish

## Dependencies (1)

- [node-watch](https://npm.io/package/node-watch.md) ^0.3.4

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-01-23

## README

# i18n-squish

Watch and compile language files into single locales ready to be served to angular-translate using angular-translate-loader-url. Can be used with or without Express and optinally watches files using `node-watch` to recompile upon changes.

## Usage

1. Require the package with an Express app and optional parameters object: `require('i18n-squish')(app, params)`.

## Options

1. `dir` (default: 'app/i18n'): the directory where all language files reside
2. `out` (default: `dir` + '/_compiled'): the directory to output compiled locale files
3. `endpoint` (default: '/api/lang'): the endpoint to create an Express GET route for fetching locales - this defaults to the angular-translate-loader-url default
4. `whitespace` (default: 0): number of spaces to use as whitespace in JSON.stringify call
5. `watch` (default: false): boolean indicating whether uncompiled langauge files in `dir` should be watched and recompiled upon changes
6. `express` (default: false): boolean indicating whether the module should create the Express endpoint defined by `endpoint`

All language files should be named after their respective locale.
A language files filepath denotes the property names which will lead to it in the compiled locale file. For example, if a language file exists at `/app/i18n/routes/login/en.json`, the compiled JSON file `en.json` will contain `routes.login`.

## Example

Given the following file structure and default options:

    /app/i18n
    |
    └─ /branding
         |
         └─en.json
         └─ fr.json
    └─ /routes
         |
         └─ en.json
         └─ fr.json
    
Compiled files will be created as follows:

    /app/i18n
    |
    └─ ... 
    └─ /_compiled
         |
         └─ en.json
         └─ fr.json

Using `express: true` and default `endpoint: '/api/lang'` options will mean retrieving the `en.json` file is as simple as sending a GET request to `/api/lang?lang=json`. This operation is performed automatically by angular-translate-loader-url when using `$translateProvider.useUrlLoader('/api/lang')`.

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