1'use strict' 2 3const path = require('path') 4const yargs = require('yargs') 5const y18n = require('y18n')({ 6 directory: path.join(__dirname, 'locales'), 7 locale: yargs.locale(), 8 updateFiles: process.env.NPX_UPDATE_LOCALE_FILES === 'true' 9}) 10 11module.exports = yTag 12function yTag (parts) { 13 let str = '' 14 parts.forEach((part, i) => { 15 str += part 16 if (arguments.length > i + 1) { 17 str += '%s' 18 } 19 }) 20 return y18n.__.apply(null, [str].concat([].slice.call(arguments, 1))) 21} 22