From bc7cfc07ed351d4dd002ff74eea6fe396b437459 Mon Sep 17 00:00:00 2001 From: "tg(x)" <*@tg-x.net> Date: Tue, 23 Feb 2016 18:37:10 +0100 Subject: [PATCH] revert i18n.parts --- extension/lib/i18n.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/extension/lib/i18n.ts b/extension/lib/i18n.ts index a722e8322..f94b687ae 100644 --- a/extension/lib/i18n.ts +++ b/extension/lib/i18n.ts @@ -54,7 +54,7 @@ var i18n = function i18n(strings, ...values) { let str = getI18nString (strings); let n = getPluralValue (values); console.log('i18n:', n, str, strings, values); - console.log('i18n:', jed.translate(str).ifPlural(n, str).fetch(...values);); + console.log('i18n:', jed.translate(str).ifPlural(n, str).fetch(...values)); return jed.translate(str).ifPlural(n, str).fetch(...values); }; @@ -64,10 +64,20 @@ i18n.strings = {}; // Interpolate i18nized values with arbitrary objects and // return array of strings/objects. i18n.parts = function(strings, ...values) { + let parts = []; + for (let i = 0; i < strings.length; i++) { + parts.push(strings[i]); + if (i < values.length) { + parts.push(values[i]); + } + } + return parts; +/* init(); let str = getI18nString (strings); let n = getPluralValue (values); console.log('i18n.parts:', n, str, values, ...values); console.log('i18n.parts:', jed.translate(str).ifPlural(n, str).fetch(...values)); return jed.translate(str).ifPlural(n, str).fetch(...values); +*/ };