From f40ab323ddefb78fc90d47f19472c614da8930b6 Mon Sep 17 00:00:00 2001 From: Ruben Vermeersch Date: Mon, 23 Dec 2013 09:18:28 +0100 Subject: [PATCH] Add migration notes. --- README.md | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 1fdd25a..5161082 100644 --- a/README.md +++ b/README.md @@ -23,17 +23,40 @@ PO.load('text.po', function (err, po) { ## Credits - Originally based on node-po (written by Michael Holly). Rebranded because - node-po is unmaintained and because this library is no longer limited to - Node.JS: it works in the browser too. +Originally based on node-po (written by Michael Holly). Rebranded because +node-po is unmaintained and because this library is no longer limited to +Node.JS: it works in the browser too. - Changes compared to node-po: +### Changes compared to node-po - * Proper handling of async methods that won't crash your Node.JS process when - something goes wrong. - * Support for parsing string flags (e.g. fuzzy). - * A test suite. - * Browser support (through Browserified and bower). +* Proper handling of async methods that won't crash your Node.JS process when + something goes wrong. +* Support for parsing string flags (e.g. fuzzy). +* A test suite. +* Browser support (through Browserified and bower). + +### Migrating from node-po + +You'll need to update the module reference: `require('pofile')` instead of +`require('node-po')`. + +At the initial release, node-po and pofile have identical APIs, with one small +exception: the `save` and `load` methods now take a callback that has an `err` +parameter: `(err)` for `save` and `(err, po)` for `load`. This is similar to +Node.JS conventions. + +Change code such as: + +```js +PO.load('text.po', function (po) { +``` + +To: + +```js +PO.load('text.po', function (err, po) { + // Handle err if needed +``` ## License