diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2022-05-23 03:12:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-23 03:12:00 +0300 |
commit | de79ff08ccbf67574b27bba7bef417503a35101f (patch) | |
tree | 53fa9069cc3e9f2943408d87b6b2f08edb373d56 /plugins/CoreHome | |
parent | 6eb89374b80a2fd9ffb947db5e367a5b502dca6e (diff) |
Allow other primitive types as arguments to translate. (#19255)
Diffstat (limited to 'plugins/CoreHome')
-rw-r--r-- | plugins/CoreHome/vue/dist/CoreHome.umd.js | 8 | ||||
-rw-r--r-- | plugins/CoreHome/vue/dist/CoreHome.umd.min.js | 2 | ||||
-rw-r--r-- | plugins/CoreHome/vue/src/translate.ts | 16 |
3 files changed, 7 insertions, 19 deletions
diff --git a/plugins/CoreHome/vue/dist/CoreHome.umd.js b/plugins/CoreHome/vue/dist/CoreHome.umd.js index 4ee2929d0d..3032d70e23 100644 --- a/plugins/CoreHome/vue/dist/CoreHome.umd.js +++ b/plugins/CoreHome/vue/dist/CoreHome.umd.js @@ -450,13 +450,7 @@ function translateOrDefault(translationStringIdOrText) { values[_key2 - 1] = arguments[_key2]; } - var pkArgs = values; // handle variadic args AND single array of values (to match _pk_translate signature) - - if (values.length === 1 && values[0] && Array.isArray(values[0])) { - pkArgs = values[0]; - } - - return window._pk_translate(translationStringIdOrText, pkArgs); // eslint-disable-line + return translate.apply(void 0, [translationStringIdOrText].concat(values)); } // CONCATENATED MODULE: ./plugins/CoreHome/vue/src/Periods/utilities.ts /*! diff --git a/plugins/CoreHome/vue/dist/CoreHome.umd.min.js b/plugins/CoreHome/vue/dist/CoreHome.umd.min.js index fcf9c4084e..c4f4956925 100644 --- a/plugins/CoreHome/vue/dist/CoreHome.umd.min.js +++ b/plugins/CoreHome/vue/dist/CoreHome.umd.min.js @@ -23,7 +23,7 @@ * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -function C(e){if(!e)return"";for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n;return 1===n.length&&n[0]&&Array.isArray(n[0])&&(i=n[0]),window._pk_translate(e,i)}function E(e){if(!e||!window.piwik_translations[e])return e;for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n;return 1===n.length&&n[0]&&Array.isArray(n[0])&&(i=n[0]),window._pk_translate(e,i)} +function C(e){if(!e)return"";for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n;return 1===n.length&&n[0]&&Array.isArray(n[0])&&(i=n[0]),window._pk_translate(e,i)}function E(e){if(!e||!window.piwik_translations[e])return e;for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return C.apply(void 0,[e].concat(n))} /*! * Matomo - free/libre analytics platform * diff --git a/plugins/CoreHome/vue/src/translate.ts b/plugins/CoreHome/vue/src/translate.ts index 37f9184bfe..e6004196b4 100644 --- a/plugins/CoreHome/vue/src/translate.ts +++ b/plugins/CoreHome/vue/src/translate.ts @@ -7,33 +7,27 @@ export function translate( translationStringId: string, - ...values: (string|string[])[] + ...values: (string|string[]|number|number[]|boolean|boolean[])[] ): string { if (!translationStringId) { return ''; } - let pkArgs = values as string[]; + let pkArgs = values as (string|number|boolean)[]; // handle variadic args AND single array of values (to match _pk_translate signature) if (values.length === 1 && values[0] && Array.isArray(values[0])) { - [pkArgs] = values as string[][]; + [pkArgs] = values as (string|number|boolean)[][]; } return window._pk_translate(translationStringId, pkArgs); // eslint-disable-line } export function translateOrDefault( translationStringIdOrText?: string, - ...values: (string|string[])[] + ...values: (string|string[]|number|number[]|boolean|boolean[])[] ): string { if (!translationStringIdOrText || !window.piwik_translations[translationStringIdOrText]) { return translationStringIdOrText!; } - let pkArgs = values as string[]; - // handle variadic args AND single array of values (to match _pk_translate signature) - if (values.length === 1 && values[0] && Array.isArray(values[0])) { - [pkArgs] = values as string[][]; - } - - return window._pk_translate(translationStringIdOrText, pkArgs); // eslint-disable-line + return translate(translationStringIdOrText!, ...values); } |