diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-11-26 17:27:33 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-11-26 17:27:33 +0100 |
commit | b7f4ecc76a1dd751fd579bb92b5aff49780ec27d (patch) | |
tree | cde41a6b045f0657a89d6179c008fdc6543edaf5 /src/i18n.tsx | |
parent | a851c3fb33335fb42de8280c6bad2a6699bb746f (diff) |
remove i18n.parts and switch fully to JSX syntax
Diffstat (limited to 'src/i18n.tsx')
-rw-r--r-- | src/i18n.tsx | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/src/i18n.tsx b/src/i18n.tsx index a8b842d9c..443d3997a 100644 --- a/src/i18n.tsx +++ b/src/i18n.tsx @@ -105,7 +105,7 @@ function getPluralValue (values: any) { /** - * Store information about the result of the last to i18n() or i18n.parts() + * Store information about the result of the last to i18n(). * * @param i18nString the string template as found in i18n.strings * @param pluralValue value returned by getPluralValue() @@ -147,42 +147,6 @@ i18n.strings = {}; /** - * Interpolate i18nized values with arbitrary objects. - * @return Array of strings/objects. - */ -i18n.parts = function(strings: string[], ...values: any[]) { - init(); - if ("object" !== typeof jed) { - // Fallback implementation in case i18n lib is not there - let parts: string[] = []; - - for (let i = 0; i < strings.length; i++) { - parts.push(strings[i]); - if (i < values.length) { - parts.push(values[i]); - } - } - return parts; - } - - let str = toI18nString(strings); - let n = getPluralValue(values); - let tr = jed.ngettext(str, str, n).split(/%(\d+)\$s/); - let parts: string[] = []; - for (let i = 0; i < tr.length; i++) { - if (0 == i % 2) { - parts.push(tr[i]); - } else { - parts.push(values[parseInt(tr[i]) - 1]); - } - } - - setI18nResult(str, n); - return parts; -}; - - -/** * Pluralize based on first numeric parameter in the template. * @todo The plural argument is used for extraction by pogen.js */ |