Skip to content
This repository was archived by the owner on Mar 4, 2019. It is now read-only.

Commit f49e60c

Browse files
committed
Add first version
1 parent 5a404df commit f49e60c

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const convert = require('yaml-to-messageformat')
2+
const loaderUtils = require('loader-utils')
3+
const MessageFormat = require('messageformat')
4+
5+
module.exports = function (input) {
6+
const options = loaderUtils.getOptions(this)
7+
const { locales, translations } = convert(input, options)
8+
const mf = new MessageFormat(locales)
9+
if (options.biDiSupport) mf.setBiDiSupport()
10+
return mf.compile(translations).toString('module.exports')
11+
}

package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "messageformat-yaml-loader",
3+
"version": "0.0.1",
4+
"description": "Webpack loader for YAML files (e.g. Rails i18n)",
5+
"keywords": [
6+
"messageformat",
7+
"yaml",
8+
"rails",
9+
"ruby",
10+
"i18n",
11+
"webpack"
12+
],
13+
"main": "index.js",
14+
"repository": "https://github.com/eemeli/messageformat-yaml-loader",
15+
"author": "Eemeli Aro <eemeli@gmail.com>",
16+
"license": "MIT",
17+
"engines": {
18+
"node": ">=6.0"
19+
},
20+
"dependencies": {
21+
"yaml-to-messageformat": "^0.1.0",
22+
"loader-utils": "^1.1.0",
23+
"messageformat": "^1.1.0"
24+
}
25+
}

0 commit comments

Comments
 (0)