Skip to content

Commit

Permalink
Merge pull request #37 from mikeedwards/update-to-0.4.0
Browse files Browse the repository at this point in the history
Update to 0.4.0
  • Loading branch information
mikeedwards committed Mar 1, 2015
2 parents 100e931 + 8ae4546 commit f3bc85b
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
node_js:
- 0.12
- 0.11
- 0.10
- 0.8
3 changes: 2 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Mike Edwards <michael.edwards@huffingtonpost.com>
gilles <gilles.devaux@gmail.com>
Asbjørn Sloth Tønnesen <ast@veridu.com>
Zach Carter <zack.carter@gmail.com>
Dan MacTough <danmactough@gmail.com>
Dan MacTough <danmactough@gmail.com>
Evan Moses
27 changes: 24 additions & 3 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
0.4.0 / 2015-03-01
==================
* Added Jed > 1.1.0 compatible format (Evan Moses)

0.3.0 / 2014-07-16
==================
* Added command line flags for fuzzy, pretty, format, and domain (Szigetvári Áron)
* Deals with fallback-to-msgid for fuzzy entries without the fuzzy flag (Szigetvári Áron)

0.2.4 / 2014-07-15
==================

* Fixed fuzzy flag (mahata)

0.2.3 / 2014-01-26
==================

* Raised minimum node version requirement to 0.8
* Raised lodash version to ~2.4.1
* Clean up documentations

0.2.0 / 2013-11-08
==================

Expand All @@ -6,7 +27,7 @@
* `po2json.parse_po` has been replaced with `po2json.parse`
* `po2json.parse` has been replaced with `po2json.parseFile`
* `po2json.parseSync` has been replaced with `po2json.parseFileSync`

Other changes in this release:

* The library has been competely rewritten, it now uses the [gettext-parser](https://github.com/andris9/gettext-parser) module to parse PO files. (Illimar Tambek)
Expand All @@ -15,15 +36,15 @@ Other changes in this release:
* Option to skip/include fuzzy translations (Illimar Tambek)


0.0.7 / 2012-10-26
0.0.7 / 2012-10-26
==================

* Fixed linting bugs and added a better fr.po fixture (Mike Edwards)
* Add tests for po2json.parse and po2json.parseSync (Dan MacTough)
* updated README.md with version history (Mike Edwards)
* updated history (Mike Edwards)

0.0.6 / 2012-10-22
0.0.6 / 2012-10-22
==================

* Add AUTHORS to identify contributors (Dan MacTough)
Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ Parse a PO buffer to JSON
* `po2json.parse(buf[, options])`
* `buf` - a _po_ file as a Buffer or an unicode string.
* `options` - an optional object with the following possible parameters:
* `fuzzy` Whether to include fuzzy translation in JSON or not. Should be either `true` or `false`. Defaults to `false`.
* `stringify` If `true`, returns a JSON string. Otherwise returns a plain Javascript object. Defaults to `false`.
* `pretty` If `true`, the resulting JSON string will be pretty-printed. Has no effect when `stringify` is `false`. Defaults to `false`
* `format` - either `raw` or `jed` or `mf`. `raw` produces a "raw" JSON output, while `jed` produces an output that is 100% compatible with Jed. `mf` produces simple key:value output. Defaults to `raw`
* `domain` - the domain the messages will be wrapped inside. Only has effect if `format: 'jed'`.
* `fuzzy` Whether to include fuzzy translation in JSON or not. Should be either `true` or `false`. Defaults to `false`.
* `stringify` If `true`, returns a JSON string. Otherwise returns a plain Javascript object. Defaults to `false`.
* `pretty` If `true`, the resulting JSON string will be pretty-printed. Has no effect when `stringify` is `false`. Defaults to `false`
* `format` Defaults to `raw`.
* `raw` produces a "raw" JSON output
* `jed` produces an output that is 100% compatible with Jed < 1.1.0
* `jed1.x` produces an output that is 100% compatible with Jed >= 1.1.0
* `mf` produces simple key:value output.
* `domain` - the domain the messages will be wrapped inside. Only has effect if `format: 'jed'`.

Parse a PO file to JSON

Expand Down Expand Up @@ -116,6 +120,9 @@ In lieu of a formal styleguide, take care to maintain the existing coding style.

## Release History

### 0.4.0 / 2015-03-01
* Added Jed > 1.1.0 compatible format (Evan Moses)

### 0.3.0 / 2014-07-16
* Added command line flags for fuzzy, pretty, format, and domain (Szigetvári Áron)
* Deals with fallback-to-msgid for fuzzy entries without the fuzzy flag (Szigetvári Áron)
Expand Down
10 changes: 5 additions & 5 deletions lib/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ module.exports = function(buffer, options) {
locale_data: {}
};
if (options.format === 'jed1.x'){
_.each(result, function(val, key){
if (key !== '' && val[0] === null){
val.shift();
}
});
for (key in result) {
if (result.hasOwnProperty(key) && key !== '' && result[key][0] === null){
result[key].shift();
}
}
}
jed.locale_data[options.domain] = result;
jed.locale_data[options.domain][''] = {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "po2json",
"description": "Convert PO files to JSON",
"version": "0.3.2",
"version": "0.4.0",
"homepage": "https://github.com/mikeedwards/po2json",
"author": {
"name": "Joshua I. Miller",
Expand Down Expand Up @@ -66,7 +66,7 @@
"po"
],
"dependencies": {
"nomnom": "1.8.0",
"gettext-parser": "~0.2.0"
"nomnom": "1.8.1",
"gettext-parser": "1.1.0"
}
}

0 comments on commit f3bc85b

Please sign in to comment.