diff --git a/packages/core/History.md b/packages/core/History.md index bde87c8..e0446dc 100644 --- a/packages/core/History.md +++ b/packages/core/History.md @@ -1,5 +1,15 @@ ## vNEXT +## v2.0.0-preview.24 (2017-05-04) + +### Added + +* Allow `mf('key', 'text', params)` in addition to the regular + `mf('key', params, 'text')` Previously, `mf('key', 'text')` was accepted + too, but there was no way to provide `params` in this ordering. Now if + the second argument is a String, the second and third arguments are swapped. + (#253). + ## v2.0.0-preview.23 (2016-09-05) ### Changed diff --git a/packages/core/lib/msgfmt.js b/packages/core/lib/msgfmt.js index 739fea0..d5f2ddb 100644 --- a/packages/core/lib/msgfmt.js +++ b/packages/core/lib/msgfmt.js @@ -159,6 +159,8 @@ msgfmt.addFormat('number', { ZAR: { style: 'currency', currency: 'ZAR' } }); msgfmt.addCurrencyShortcut('ILS'); mf = function mfcall(key, params, message, locale) { + var tmp; + if (!locale) { if (Meteor.isClient) { locale = Session.get('locale'); @@ -176,12 +178,13 @@ mf = function mfcall(key, params, message, locale) { } } - } + } if (!locale || (!mfPkg.strings[locale] && !mfPkg.compiled[locale])) locale = mfPkg.native; if (_.isString(params)) { + tmp = message; message = params; - params = null; + params = tmp; } var mf = mfPkg.objects[locale]; @@ -226,7 +229,7 @@ mf = function mfcall(key, params, message, locale) { // Give up } } - + return formatted; } diff --git a/packages/core/package.js b/packages/core/package.js index d787993..09be223 100644 --- a/packages/core/package.js +++ b/packages/core/package.js @@ -1,6 +1,6 @@ Package.describe({ name: "msgfmt:core", - version: "2.0.0-preview.23", + version: "2.0.0-preview.24", summary: "MessageFormat i18n support, the Meteor way", git: "https://github.com/gadicc/meteor-messageformat.git", documentation: 'README.md'