handlebars-i18n 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/coveralls.yml +44 -0
- package/dist/handlebars-i18n.d.ts +3 -3
- package/dist/handlebars-i18n.js +22 -29
- package/dist/handlebars-i18n.min.js +1 -1
- package/package.json +8 -7
- package/readme.md +3 -3
- package/test/handlebars-i18n.test.js +252 -228
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Test and Coverage
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "master" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "master" ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
|
|
16
|
+
- name: Use Node.js 16.x
|
|
17
|
+
uses: actions/setup-node@v3
|
|
18
|
+
with:
|
|
19
|
+
node-version: 16.x
|
|
20
|
+
|
|
21
|
+
- name: npm install, make test-coverage
|
|
22
|
+
run: |
|
|
23
|
+
npm install
|
|
24
|
+
npm run test:coverage
|
|
25
|
+
sleep 2
|
|
26
|
+
|
|
27
|
+
- name: Report Coveralls (Linux)
|
|
28
|
+
if: startsWith(runner.os, 'Linux')
|
|
29
|
+
run: curl -sL https://coveralls.io/coveralls-linux.tar.gz | tar -xz && ./coveralls
|
|
30
|
+
env:
|
|
31
|
+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
32
|
+
|
|
33
|
+
- name: Report Coveralls (Windows)
|
|
34
|
+
if: startsWith(runner.os, 'Windows')
|
|
35
|
+
run: curl -sL https://github.com/coverallsapp/coverage-reporter/releases/latest/download/coveralls-windows.zip | zcat > ./coveralls.exe && ./coveralls.exe
|
|
36
|
+
env:
|
|
37
|
+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
38
|
+
|
|
39
|
+
- name: Report Coveralls (macOS)
|
|
40
|
+
if: startsWith(runner.os, 'macOS')
|
|
41
|
+
run: |
|
|
42
|
+
brew tap coverallsapp/coveralls --quiet
|
|
43
|
+
brew install coveralls --quiet
|
|
44
|
+
coveralls
|
|
@@ -18,7 +18,7 @@ type unitDisplay = "short" | "narrow" | "long";
|
|
|
18
18
|
type roundingPriority = "auto" | "morePrecision" | "lessPrecision";
|
|
19
19
|
|
|
20
20
|
type roundingMode =
|
|
21
|
-
|
|
21
|
+
"ceil"
|
|
22
22
|
| "floor"
|
|
23
23
|
| "expand"
|
|
24
24
|
| "trunc"
|
|
@@ -197,13 +197,13 @@ export type DateTimeFormatConfiguration = [
|
|
|
197
197
|
CustomFormatName?
|
|
198
198
|
];
|
|
199
199
|
|
|
200
|
-
|
|
201
200
|
type DateRelFormatOptions = {
|
|
202
201
|
localeMatcher?: localeMatcher,
|
|
203
202
|
numberingSystem?: numberingSystem,
|
|
204
203
|
numeric?: "always" | "auto",
|
|
205
204
|
style?: "long" | "short" | "narrow",
|
|
206
|
-
|
|
205
|
+
timeZone?: TimeZone,
|
|
206
|
+
unit?: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year"
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
export type RelativeTimeFormatConfiguration = [
|
package/dist/handlebars-i18n.js
CHANGED
|
@@ -17,15 +17,14 @@
|
|
|
17
17
|
const Handlebars = require('handlebars'),
|
|
18
18
|
i18next = require('i18next'),
|
|
19
19
|
Intl = require('intl'),
|
|
20
|
-
RelativeTimeFormat= require('relative-time-format');
|
|
20
|
+
RelativeTimeFormat = require('relative-time-format');
|
|
21
21
|
module.exports = factory(
|
|
22
22
|
Handlebars,
|
|
23
23
|
i18next,
|
|
24
24
|
Intl,
|
|
25
25
|
RelativeTimeFormat,
|
|
26
26
|
process?.env?.NODE_ENV === 'TEST');
|
|
27
|
-
}
|
|
28
|
-
else if (typeof define === 'function' && define.amd)
|
|
27
|
+
} else if (typeof define === 'function' && define.amd)
|
|
29
28
|
define(['Handlebars', 'i18next', 'Intl'], factory);
|
|
30
29
|
else if (typeof root.Handlebars === 'object'
|
|
31
30
|
&& typeof root.i18next === 'object'
|
|
@@ -151,7 +150,7 @@
|
|
|
151
150
|
return false;
|
|
152
151
|
}
|
|
153
152
|
|
|
154
|
-
if (!
|
|
153
|
+
if (!['DateTimeFormat', 'RelativeTimeFormat', 'NumberFormat', 'PriceFormat'].includes(typeOfFormat)) {
|
|
155
154
|
console.error('@ handlebars-i18n.configure(): Invalid argument <' + typeOfFormat + '>. ' +
|
|
156
155
|
'Second argument must be a string with the options key. ' +
|
|
157
156
|
'Use either "DateTimeFormat", "RelativeTimeFormat", "NumberFormat", or "PriceFormat".');
|
|
@@ -191,8 +190,7 @@
|
|
|
191
190
|
optionsConf[formatType].custom[customFormat] = {};
|
|
192
191
|
|
|
193
192
|
optionsConf[formatType].custom[customFormat][lang] = options;
|
|
194
|
-
}
|
|
195
|
-
else
|
|
193
|
+
} else
|
|
196
194
|
optionsConf[formatType].standard[lang] = options;
|
|
197
195
|
|
|
198
196
|
return true;
|
|
@@ -221,8 +219,7 @@
|
|
|
221
219
|
if (typeof dateInput === 'number') {
|
|
222
220
|
// input as milliseconds since unix epoch, like: 1583922952743
|
|
223
221
|
date = new Date(dateInput);
|
|
224
|
-
}
|
|
225
|
-
else if (typeof dateInput === 'string') {
|
|
222
|
+
} else if (typeof dateInput === 'string') {
|
|
226
223
|
|
|
227
224
|
if (dateInput.charAt(0) === '[' && dateInput.slice(-1) === ']') {
|
|
228
225
|
// input as array represented as string such as "[2020, 11]"
|
|
@@ -230,17 +227,14 @@
|
|
|
230
227
|
let dateArr = dateInput.split(',');
|
|
231
228
|
let dateFactory = __applyToConstructor.bind(null, Date);
|
|
232
229
|
date = dateFactory(dateArr);
|
|
233
|
-
}
|
|
234
|
-
else if (dateInput.toLowerCase() === 'now' || dateInput.toLowerCase() === 'today') {
|
|
230
|
+
} else if (dateInput.toLowerCase() === 'now' || dateInput.toLowerCase() === 'today') {
|
|
235
231
|
// input as word "now" or "today"
|
|
236
232
|
date = new Date();
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
233
|
+
} else {
|
|
239
234
|
// input as date string such as "1995-12-17T03:24:00"
|
|
240
235
|
date = new Date(dateInput);
|
|
241
236
|
}
|
|
242
|
-
}
|
|
243
|
-
else {
|
|
237
|
+
} else {
|
|
244
238
|
// fallback: today’s date
|
|
245
239
|
date = new Date();
|
|
246
240
|
}
|
|
@@ -337,8 +331,7 @@
|
|
|
337
331
|
else
|
|
338
332
|
return false;
|
|
339
333
|
});
|
|
340
|
-
}
|
|
341
|
-
else {
|
|
334
|
+
} else {
|
|
342
335
|
if (__validateArgs(langOrArr, typeOfFormat, options, customFormatName))
|
|
343
336
|
__setArgs(langOrArr, typeOfFormat, options, customFormatName);
|
|
344
337
|
else
|
|
@@ -393,7 +386,7 @@
|
|
|
393
386
|
* @returns {*}
|
|
394
387
|
*/
|
|
395
388
|
function (str, attributes) {
|
|
396
|
-
return new handlebars.SafeString((typeof(i18next) !== 'undefined' ? i18next.t(str, attributes.hash) : str));
|
|
389
|
+
return new handlebars.SafeString((typeof (i18next) !== 'undefined' ? i18next.t(str, attributes.hash) : str));
|
|
397
390
|
}
|
|
398
391
|
);
|
|
399
392
|
handlebars.registerHelper('_locale',
|
|
@@ -445,7 +438,7 @@
|
|
|
445
438
|
* @param options
|
|
446
439
|
*/
|
|
447
440
|
function (dateInput, options) {
|
|
448
|
-
const date= __createDateObj(dateInput);
|
|
441
|
+
const date = __createDateObj(dateInput);
|
|
449
442
|
const opts = __configLookup(options, i18next.language, optionsConf.DateTimeFormat);
|
|
450
443
|
const dateFormat = new Intl.DateTimeFormat(i18next.language, opts);
|
|
451
444
|
return dateFormat.format(date);
|
|
@@ -468,7 +461,7 @@
|
|
|
468
461
|
* @returns {string}
|
|
469
462
|
*/
|
|
470
463
|
function (dateValue, options) {
|
|
471
|
-
const relDate= parseInt(dateValue);
|
|
464
|
+
const relDate = parseInt(dateValue);
|
|
472
465
|
const opts = __configLookup(options, i18next.language, optionsConf.RelativeTimeFormat);
|
|
473
466
|
const relDateFormat = __getRelDateFormatPolyfill(i18next.language, opts);
|
|
474
467
|
return relDateFormat.format(relDate, opts.unit);
|
|
@@ -485,20 +478,20 @@
|
|
|
485
478
|
function (dateInputA, dateInputB, options) {
|
|
486
479
|
|
|
487
480
|
let dateDiff;
|
|
481
|
+
let opts = __configLookup(options, i18next.language, optionsConf.RelativeTimeFormat);
|
|
488
482
|
|
|
489
|
-
if (!
|
|
483
|
+
if (!__isNumOrString(dateInputA)) {
|
|
484
|
+
console.error('@ handlebars-i18n: invalid first argument dateInputA was given for _dateDiff.');
|
|
490
485
|
return null;
|
|
491
|
-
else if (! __isNumOrString(dateInputB))
|
|
492
|
-
dateDiff = __createDateObj(dateInputA);
|
|
493
|
-
else if (! __isNumOrString(dateInputA))
|
|
494
|
-
dateDiff = __createDateObj(dateInputB);
|
|
495
|
-
else {
|
|
496
|
-
const dateA= __createDateObj(dateInputA);
|
|
497
|
-
const dateB= __createDateObj(dateInputB);
|
|
498
|
-
dateDiff = dateA - dateB;
|
|
499
486
|
}
|
|
500
487
|
|
|
501
|
-
|
|
488
|
+
dateInputB = dateInputB || 'now';
|
|
489
|
+
|
|
490
|
+
let dateA = __createDateObj(dateInputA);
|
|
491
|
+
let dateB = __createDateObj(dateInputB);
|
|
492
|
+
|
|
493
|
+
dateDiff = dateA - dateB;
|
|
494
|
+
|
|
502
495
|
const relDate = __getDateDiff(dateDiff, opts.unit);
|
|
503
496
|
const relDateFormat = __getRelDateFormatPolyfill(i18next.language, opts);
|
|
504
497
|
return relDateFormat.format(relDate, opts.unit);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,r){if("object"==typeof exports&&"object"==typeof module){const e=require("handlebars"),t=require("i18next"),n=require("intl"),a=require("relative-time-format");module.exports=r(e,t,n,a,"TEST"===process?.env?.NODE_ENV)}else if("function"==typeof define&&define.amd)define(["Handlebars","i18next","Intl"],r);else{if("object"!=typeof e.Handlebars||"object"!=typeof e.i18next||"object"!=typeof e.Intl)return console.error("@ handlebars-i18n: One or more dependencies are missing. Check for Handlebars, i18next and Intl."),!1;e.HandlebarsI18n=r(e.Handlebars,e.i18next,e.Intl)}}(this,(function(e,r,t,n,a){"use strict";const o={DateTimeFormat:{standard:{},custom:{}},RelativeTimeFormat:{standard:{all:{unit:"hours"}},custom:{}},NumberFormat:{standard:{},custom:{}},PriceFormat:{standard:{all:{style:"currency",currency:"EUR"}},custom:{}}};let i=JSON.parse(JSON.stringify(o));const u={};function s(e,r){let t=[null].concat(r);return new(e.bind.apply(e,t))}function l(e,r,t){if("object"==typeof e&&"object"==typeof e.hash&&Object.keys(e.hash).length>0){let n=e.hash;if(void 0===n.format)return n;if(void 0!==t.custom[n.format]&&void 0!==t.custom[n.format][r])return t.custom[n.format][r]}return void 0!==t.standard[r]?t.standard[r]:void 0!==t.standard.all?t.standard.all:{}}function c(e,r,t,n){return"string"!=typeof e?(console.error("@ handlebars-i18n.configure(): Invalid argument <"+e+'> First argument must be a string with language code such as "en".'),!1):["DateTimeFormat","RelativeTimeFormat","NumberFormat","PriceFormat"].includes(r)?"object"!=typeof t?(console.error("@ handlebars-i18n.configure(): Invalid argument <"+t+"> Third argument must be an object containing the configuration parameters."),!1):(null==n||"string"==typeof n)&&""!==n&&" "!==n||(console.error("@ handlebars-i18n.configure(): Invalid argument <"+n+"> Fourth argument (optional) must be a string naming your custom format configuration."),!1):(console.error("@ handlebars-i18n.configure(): Invalid argument <"+r+'>. Second argument must be a string with the options key. Use either "DateTimeFormat", "RelativeTimeFormat", "NumberFormat", or "PriceFormat".'),!1)}function m(e,r,t,n){return null!=n?(void 0===i[r].custom[n]&&(i[r].custom[n]={}),i[r].custom[n][e]=t):i[r].standard[e]=t,!0}function f(e){return"number"==typeof e||"string"==typeof e&&""!==e}function g(e){let r;if("number"==typeof e)r=new Date(e);else if("string"==typeof e)if("["===e.charAt(0)&&"]"===e.slice(-1)){let t=(e=e.substring(1,e.length-1).replace(/ /g,"")).split(",");r=s.bind(null,Date)(t)}else r="now"===e.toLowerCase()||"today"===e.toLowerCase()?new Date:new Date(e);else r=new Date;return r}function d(e,r){if("function"==typeof t.RelativeTimeFormat)return new t.RelativeTimeFormat(e,r);if(void 0===u[e])try{u[e]=require(`relative-time-format/locale/${e}`)}catch(e){console.error(e)}return n.addLocale(u[e]),new n(e,r)}function b(e,r){return r=r||"hour",Math.trunc(e/{second:1e3,seconds:1e3,minute:6e4,minutes:6e4,hour:36e5,hours:36e5,day:864e5,days:864e5,week:6048e5,weeks:6048e5,month:2629746e3,months:2629746e3,quarter:78894e5,quarters:78894e5,year:315576e5,years:315576e5}[r])}return{configure:function(e,r,t,n){if("string"!=typeof e&&!Array.isArray(e))return console.error("@ handlebars-i18n.configure(): Invalid argument <"+e+'> First argument must be a string with language code such as "en" or an array with language parameters.'),!1;if(Array.isArray(e)){if(e.length<1)return console.log("@ handlebars-i18n.configure(): You passed an empty array, no parameters taken."),!1;e.forEach((e=>{if(!c(e[0],e[1],e[2],e[3]))return!1;m(e[0],e[1],e[2],e[3])}))}else{if(!c(e,r,t,n))return!1;m(e,r,t,n)}return!0},reset:function(){return i=JSON.parse(JSON.stringify(o)),!0},init:function(n,a){return"object"==typeof n&&null!==n?e=n:null!=n&&console.error("@ handlebars-i18n.init(): Invalid Argument [1] given for overrideHndlbrs. Argument must be the Handlebars object. Using generic Handlebars object instead."),"object"==typeof a&&null!==a?r=a:null!=a&&console.error("@ handlebars-i18n.init(): Invalid Argument [2] given for overrideI18n. Argument must be the i18next object. Using generic i18next object on module level instead."),e.registerHelper("__",(function(t,n){return new e.SafeString(void 0!==r?r.t(t,n.hash):t)})),e.registerHelper("_locale",(function(){return r.language})),e.registerHelper("localeIs",(function(e){return r.language===e})),e.registerHelper("_date",(function(e,n){const a=g(e),o=l(n,r.language,i.DateTimeFormat);return new t.DateTimeFormat(r.language,o).format(a)})),e.registerHelper("_dateRel",(function(e,t){const n=parseInt(e),a=l(t,r.language,i.RelativeTimeFormat);return d(r.language,a).format(n,a.unit)})),e.registerHelper("_dateDiff",(function(e,t,n){let a;if(!f(e)
|
|
1
|
+
!function(e,r){if("object"==typeof exports&&"object"==typeof module){const e=require("handlebars"),t=require("i18next"),n=require("intl"),a=require("relative-time-format");module.exports=r(e,t,n,a,"TEST"===process?.env?.NODE_ENV)}else if("function"==typeof define&&define.amd)define(["Handlebars","i18next","Intl"],r);else{if("object"!=typeof e.Handlebars||"object"!=typeof e.i18next||"object"!=typeof e.Intl)return console.error("@ handlebars-i18n: One or more dependencies are missing. Check for Handlebars, i18next and Intl."),!1;e.HandlebarsI18n=r(e.Handlebars,e.i18next,e.Intl)}}(this,(function(e,r,t,n,a){"use strict";const o={DateTimeFormat:{standard:{},custom:{}},RelativeTimeFormat:{standard:{all:{unit:"hours"}},custom:{}},NumberFormat:{standard:{},custom:{}},PriceFormat:{standard:{all:{style:"currency",currency:"EUR"}},custom:{}}};let i=JSON.parse(JSON.stringify(o));const u={};function s(e,r){let t=[null].concat(r);return new(e.bind.apply(e,t))}function l(e,r,t){if("object"==typeof e&&"object"==typeof e.hash&&Object.keys(e.hash).length>0){let n=e.hash;if(void 0===n.format)return n;if(void 0!==t.custom[n.format]&&void 0!==t.custom[n.format][r])return t.custom[n.format][r]}return void 0!==t.standard[r]?t.standard[r]:void 0!==t.standard.all?t.standard.all:{}}function c(e,r,t,n){return"string"!=typeof e?(console.error("@ handlebars-i18n.configure(): Invalid argument <"+e+'> First argument must be a string with language code such as "en".'),!1):["DateTimeFormat","RelativeTimeFormat","NumberFormat","PriceFormat"].includes(r)?"object"!=typeof t?(console.error("@ handlebars-i18n.configure(): Invalid argument <"+t+"> Third argument must be an object containing the configuration parameters."),!1):(null==n||"string"==typeof n)&&""!==n&&" "!==n||(console.error("@ handlebars-i18n.configure(): Invalid argument <"+n+"> Fourth argument (optional) must be a string naming your custom format configuration."),!1):(console.error("@ handlebars-i18n.configure(): Invalid argument <"+r+'>. Second argument must be a string with the options key. Use either "DateTimeFormat", "RelativeTimeFormat", "NumberFormat", or "PriceFormat".'),!1)}function m(e,r,t,n){return null!=n?(void 0===i[r].custom[n]&&(i[r].custom[n]={}),i[r].custom[n][e]=t):i[r].standard[e]=t,!0}function f(e){return"number"==typeof e||"string"==typeof e&&""!==e}function g(e){let r;if("number"==typeof e)r=new Date(e);else if("string"==typeof e)if("["===e.charAt(0)&&"]"===e.slice(-1)){let t=(e=e.substring(1,e.length-1).replace(/ /g,"")).split(",");r=s.bind(null,Date)(t)}else r="now"===e.toLowerCase()||"today"===e.toLowerCase()?new Date:new Date(e);else r=new Date;return r}function d(e,r){if("function"==typeof t.RelativeTimeFormat)return new t.RelativeTimeFormat(e,r);if(void 0===u[e])try{u[e]=require(`relative-time-format/locale/${e}`)}catch(e){console.error(e)}return n.addLocale(u[e]),new n(e,r)}function b(e,r){return r=r||"hour",Math.trunc(e/{second:1e3,seconds:1e3,minute:6e4,minutes:6e4,hour:36e5,hours:36e5,day:864e5,days:864e5,week:6048e5,weeks:6048e5,month:2629746e3,months:2629746e3,quarter:78894e5,quarters:78894e5,year:315576e5,years:315576e5}[r])}return{configure:function(e,r,t,n){if("string"!=typeof e&&!Array.isArray(e))return console.error("@ handlebars-i18n.configure(): Invalid argument <"+e+'> First argument must be a string with language code such as "en" or an array with language parameters.'),!1;if(Array.isArray(e)){if(e.length<1)return console.log("@ handlebars-i18n.configure(): You passed an empty array, no parameters taken."),!1;e.forEach((e=>{if(!c(e[0],e[1],e[2],e[3]))return!1;m(e[0],e[1],e[2],e[3])}))}else{if(!c(e,r,t,n))return!1;m(e,r,t,n)}return!0},reset:function(){return i=JSON.parse(JSON.stringify(o)),!0},init:function(n,a){return"object"==typeof n&&null!==n?e=n:null!=n&&console.error("@ handlebars-i18n.init(): Invalid Argument [1] given for overrideHndlbrs. Argument must be the Handlebars object. Using generic Handlebars object instead."),"object"==typeof a&&null!==a?r=a:null!=a&&console.error("@ handlebars-i18n.init(): Invalid Argument [2] given for overrideI18n. Argument must be the i18next object. Using generic i18next object on module level instead."),e.registerHelper("__",(function(t,n){return new e.SafeString(void 0!==r?r.t(t,n.hash):t)})),e.registerHelper("_locale",(function(){return r.language})),e.registerHelper("localeIs",(function(e){return r.language===e})),e.registerHelper("_date",(function(e,n){const a=g(e),o=l(n,r.language,i.DateTimeFormat);return new t.DateTimeFormat(r.language,o).format(a)})),e.registerHelper("_dateRel",(function(e,t){const n=parseInt(e),a=l(t,r.language,i.RelativeTimeFormat);return d(r.language,a).format(n,a.unit)})),e.registerHelper("_dateDiff",(function(e,t,n){let a,o=l(n,r.language,i.RelativeTimeFormat);if(!f(e))return console.error("@ handlebars-i18n: invalid first argument dateInputA was given for _dateDiff."),null;t=t||"now",a=g(e)-g(t);const u=b(a,o.unit);return d(r.language,o).format(u,o.unit)})),e.registerHelper("_num",(function(e,n){let a=l(n,r.language,i.NumberFormat);return new t.NumberFormat(r.language,a).format(e)})),e.registerHelper("_price",(function(e,n){let a=l(n,r.language,i.PriceFormat);"string"!=typeof a.style&&"string"==typeof a.currency&&(a.style="currency");return new t.NumberFormat(r.language,a).format(e)})),e},...a&&{private:{applyToConstructor:s,configLookup:l,validateArgs:c,setArgs:m,isNumOrString:f,createDateObj:g,getRelDateFormatPolyfill:d,getDateDiff:b}}}}));
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "handlebars-i18n",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "handlebars-i18n adds internationalization to handlebars.js using i18next and Intl.",
|
|
5
5
|
"main": "dist/handlebars-i18n.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "NODE_ENV=TEST
|
|
8
|
-
"
|
|
7
|
+
"test": "NODE_ENV=TEST c8 mocha",
|
|
8
|
+
"test:coverage": "npm run test && NODE_ENV=TEST c8 report --reporter=text-lcov > coverage/lcov.info",
|
|
9
9
|
"compress": "gulp compress",
|
|
10
10
|
"example:js": "cd examples/node-example && node simple-example.js",
|
|
11
11
|
"example:ts": "cd examples/typescript && tsc && node index.js"
|
|
@@ -48,16 +48,17 @@
|
|
|
48
48
|
"@commitlint/config-conventional": "16.2.1",
|
|
49
49
|
"@types/intl": "^1.2.0",
|
|
50
50
|
"@types/node": "^18.13.0",
|
|
51
|
+
"c8": "^10.1.2",
|
|
51
52
|
"chai": "4.3.6",
|
|
52
|
-
"coveralls": "
|
|
53
|
-
"gulp": "
|
|
53
|
+
"coveralls-next": "^4.2.1",
|
|
54
|
+
"gulp": "5.0.0",
|
|
54
55
|
"gulp-rename": "2.0.0",
|
|
55
56
|
"gulp-uglify": "3.0.2",
|
|
56
57
|
"gulp-uglify-es": "3.0.0",
|
|
57
58
|
"html-entities": "^2.5.2",
|
|
58
59
|
"husky": "7.0.4",
|
|
59
|
-
"
|
|
60
|
-
"mocha": "
|
|
60
|
+
"mocha": "10.7.3",
|
|
61
|
+
"mocha-lcov-reporter": "^1.3.0",
|
|
61
62
|
"nyc": "15.1.0",
|
|
62
63
|
"typescript": "^4.9.5"
|
|
63
64
|
},
|
package/readme.md
CHANGED
|
@@ -10,7 +10,7 @@ Handlebars-i18n is listed amongst i18next’s [framework helpers](https://www.i1
|
|
|
10
10
|
[](https://opensource.org/licenses/MIT)
|
|
11
11
|

|
|
12
12
|
[](https://github.com/fwalzel/handlebars-i18n/actions/workflows/node.js.yml/badge.svg)
|
|
13
|
-
[](https://coveralls.io/github/Aller-Couleur/handlebars-i18n?branch=master)
|
|
14
14
|
[](https://codeclimate.com/github/Aller-Couleur/handlebars-i18n)
|
|
15
15
|
[](https://snyk.io/test/github/Aller-Couleur/handlebars-i18n/badge.svg)
|
|
16
16
|

|
|
@@ -328,8 +328,8 @@ Will output for "en" → **in 7 hours**
|
|
|
328
328
|
Will output for "en" → **7 hours ago**
|
|
329
329
|
|
|
330
330
|
A positive number argument leads to a future event statement, a negative refers to a past date. Possible units
|
|
331
|
-
are `"second"` | `"minute"` | `"hour"` | `"day"` | `"week"` | `"month"` | `"year"` (default is `"hour"`).
|
|
332
|
-
set of options (such as `numberingSystem` or `localeMatcher`)
|
|
331
|
+
are `"second"` | `"minute"` | `"hour"` | `"day"` | `"week"` | `"month"` | `"quarter"` |`"year"` (default is `"hour"`).
|
|
332
|
+
For a complete set of options (such as `numberingSystem` or `localeMatcher`)
|
|
333
333
|
see [Intl.RelativeTimeFormat Constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat).
|
|
334
334
|
Alternatively check this repo’s TS types
|
|
335
335
|
in [handlebars-i18n.d.ts](./dist/handlebars-i18n.d.ts).
|