aboutsummaryrefslogtreecommitdiff
path: root/node_modules/y18n/index.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/y18n/index.js
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/y18n/index.js')
-rw-r--r--node_modules/y18n/index.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/node_modules/y18n/index.js b/node_modules/y18n/index.js
index 91b159e34..d72068162 100644
--- a/node_modules/y18n/index.js
+++ b/node_modules/y18n/index.js
@@ -16,6 +16,9 @@ function Y18N (opts) {
}
Y18N.prototype.__ = function () {
+ if (typeof arguments[0] !== 'string') {
+ return this._taggedLiteral.apply(this, arguments)
+ }
var args = Array.prototype.slice.call(arguments)
var str = args.shift()
var cb = function () {} // start with noop.
@@ -40,6 +43,19 @@ Y18N.prototype.__ = function () {
return util.format.apply(util, [this.cache[this.locale][str] || str].concat(args))
}
+Y18N.prototype._taggedLiteral = function (parts) {
+ var args = arguments
+ var str = ''
+ parts.forEach(function (part, i) {
+ var arg = args[i + 1]
+ str += part
+ if (typeof arg !== 'undefined') {
+ str += '%s'
+ }
+ })
+ return this.__.apply(null, [str].concat([].slice.call(arguments, 1)))
+}
+
Y18N.prototype._enqueueWrite = function (work) {
this.writeQueue.push(work)
if (this.writeQueue.length === 1) this._processWriteQueue()