From 2a8bb61f17352ec3b8c5d89c147a2ec1e642ff2e Mon Sep 17 00:00:00 2001 From: kabir-afk Date: Wed, 5 Jun 2024 17:59:24 +0530 Subject: [PATCH] Updated i18n as per SearchWidget placeholder message --- popup/popup.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/popup/popup.js b/popup/popup.js index 23d1eff..5524a6e 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -30,7 +30,13 @@ var browser = (browserType === 'firefox') ? browser : (browserType === 'chrome') // which fetches the messages from sourceMap and replpace them with whatever the key-value pair // for that particular message is - banana = {i18n: msg => sourceMap.get(resArr[1])[msg]}; + banana = {i18n: (msg,argument) => { + let string = sourceMap.get(resArr[1])[msg]; + if ((/\$1/).test(string)) { + string = string.replace(/\$1/,argument); + } + return string; + }}; console.log("banana received: ",banana); } else if (browserType === 'firefox') { // Use Firefox WebExtensions API