Skip to content

Commit d3d3ad2

Browse files
committed
First version
1 parent 2578d34 commit d3d3ad2

5 files changed

Lines changed: 224 additions & 0 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.*
2+
node_modules/
3+
example/dist/bundle.js

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright 2018 Eemeli Aro <eemeli@gmail.com>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

index.js

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

package-lock.json

Lines changed: 164 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

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

0 commit comments

Comments
 (0)