File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ Y18N.prototype._taggedLiteral = function (parts) {
4949 parts . forEach ( function ( part , i ) {
5050 var arg = args [ i + 1 ]
5151 str += part
52- if ( arg ) {
52+ if ( typeof arg !== 'undefined' ) {
5353 str += '%s'
5454 }
5555 } )
Original file line number Diff line number Diff line change @@ -38,6 +38,14 @@ describe('y18n', function () {
3838
3939 __ `Hi, ${ 'Ben' } ${ 'Coe' } !` . should . equal ( 'Yarr! Shiver me timbers, why \'tis Ben Coe!' )
4040 } )
41+ it ( 'can be used as a tag for template literals with falsy arguments' , function ( ) {
42+ var __ = y18n ( {
43+ locale : 'pirate' ,
44+ directory : path . join ( __dirname , 'locales' )
45+ } ) . __
46+
47+ __ `Hi, ${ 'Ben' } ${ '' } !` . should . equal ( 'Yarr! Shiver me timbers, why \'tis Ben !' )
48+ } )
4149 it ( 'uses replacements from the default locale if none is configured' , function ( ) {
4250 var __ = y18n ( {
4351 directory : path . join ( __dirname , 'locales' )
You can’t perform that action at this time.
0 commit comments