# message-format-loader

> Write default messages inline. Transpile translations with webpack.

Latest version **1.0.5** (published 2015-03-11) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install message-format-loader
pnpm add message-format-loader
yarn add message-format-loader
bun add message-format-loader
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2015-03-11 |
| First published | 2015-02-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Andy VanWagoner |
| Maintainers | thetalecrafter |
| Keywords | i18n, intl, internationalization, localization, globalization, messageformat, pluralformat, selectformat, webpack, plural, gender, icu |

## Links

- npm: https://www.npmjs.com/package/message-format-loader
- Repository: http://github.com/thetalecrafter/message-format-loader
- Homepage: https://github.com/thetalecrafter/message-format-loader
- Issues: https://github.com/thetalecrafter/message-format-loader/issues
- npm.io page: https://npm.io/package/message-format-loader

## Dependencies (2)

- [loader-utils](https://npm.io/package/loader-utils.md) 0.2.6
- [object-assign](https://npm.io/package/object-assign.md) 2.0.0

## 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.5 (latest) — 2015-03-11
- 1.0.4 — 2015-03-11
- 1.0.0 — 2015-02-26
- 0.2.0 — 2015-02-19
- 0.1.2 — 2015-02-19
- 0.1.1 — 2015-02-18
- 0.1.0 — 2015-02-18

## README

# message-format-loader

Write default messages inline. Transpile translations with webpack.

[![npm Version][npm-image]][npm]
[![Dependency Status][deps-image]][deps]

> a webpack loader for message-format

## install

```console
$ npm install message-format-loader --save-dev
```

## api

### messageFormat

in your `webpack.config.js`

These are the same as options that are passed to `format.setup()`
See [message-format-inline][message-format-inline] for more information

```javascript
module.exports = [ "en", "pt" ].map(function(locale) {
	entry: "path/to/entry.js",
	output: {
		path: "path/to/output/",
		filename: "bundle.js"
	},
	module: {
		loaders: [
			{
				test:   /\.js$/,
				loader: "message-format"
			}
		]
	},
	messageFormat: {
		functionName: 'format', // identifier of function to inline
		locale: locale, // default locale
		translate: function(pattern, locales) {
			// from call format(pattern, args, locales)
			// if no locales were passed to format, locales will be the default locale (specified above)
			return require('path/to/translations/' + locale + '.json')[pattern];
		},
		translations: { // or rather than a translate function, lookup from an object
			pt: { ... },
			de: { ... }
		},
		keyType: 'underscored_crc32'
	}
});
```

in your js file:

```javascript
var format = require('message-format-inline')
format('Welcome {name}!', { name:'Bob' })
```


License
-------

This software is free to use under the MIT license.
See the [LICENSE-MIT file][LICENSE] for license text and copyright information.


[npm]: https://www.npmjs.org/package/message-format-loader
[npm-image]: https://img.shields.io/npm/v/message-format-loader.svg
[deps]: https://david-dm.org/thetalecrafter/message-format-loader
[deps-image]: https://img.shields.io/david/thetalecrafter/message-format-loader.svg
[message-format]: https://github.com/thetalecrafter/message-format
[message-format-inline]: https://github.com/thetalecrafter/message-format-inline
[LICENSE]: https://github.com/thetalecrafter/message-format-loader/blob/master/LICENSE-MIT

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