diff --git a/services/web/scripts/translations/insertHTMLFragments.js b/services/web/scripts/translations/insertHTMLFragments.js
new file mode 100644
index 0000000000..c50f453d18
--- /dev/null
+++ b/services/web/scripts/translations/insertHTMLFragments.js
@@ -0,0 +1,37 @@
+/*
+ This script will aid the process of inserting HTML fragments into all the
+ locales.
+ We are migrating from
+ locale: 'PRE __key1__ POST'
+ pug: translate(localeKey, { key1: 'VALUE' })
+ to
+ locale: 'PRE <0>__key1__0> POST'
+ pug: translate(localeKey, { key1: 'VALUE' }, ['b'])
+
+
+ MAPPING entries:
+ localeKey: ['key1', 'key2']
+ click_here_to_view_sl_in_lng: ['lngName']
+ */
+const MAPPING = {}
+
+const { transformLocales } = require('./transformLocales')
+
+function transformLocale(locale, components) {
+ components.forEach((key, idx) => {
+ const i18nKey = `__${key}__`
+ const replacement = `<${idx}>${i18nKey}${idx}>`
+ if (!locale.includes(replacement)) {
+ locale = locale.replace(new RegExp(i18nKey, 'g'), replacement)
+ }
+ })
+ return locale
+}
+
+function main() {
+ transformLocales(MAPPING, transformLocale)
+}
+
+if (require.main === module) {
+ main()
+}
diff --git a/services/web/scripts/translations/replaceLinkFragments.js b/services/web/scripts/translations/replaceLinkFragments.js
new file mode 100644
index 0000000000..d7615cc6b4
--- /dev/null
+++ b/services/web/scripts/translations/replaceLinkFragments.js
@@ -0,0 +1,35 @@
+/*
+ This script will aid the process of inserting HTML fragments into all the
+ locales.
+ We are migrating from
+ locale: 'PRE __keyLinkOpen__INNER__keyLinkClose__ POST'
+ pug: translate(localeKey, { keyLinkOpen: '', keyLinkClose: '' })
+ to
+ locale: 'PRE <0>INNER0> POST'
+ pug: translate(localeKey, {}, [{ name: 'a', attrs: { href: '...', ... }}])
+
+
+ MAPPING entries:
+ localeKey: ['keyLinkOpen', 'keyLinkClose']
+ faq_pay_by_invoice_answer: ['payByInvoiceLinkOpen', 'payByInvoiceLinkClose']
+ */
+const MAPPING = {}
+
+const { transformLocales } = require('./transformLocales')
+
+function transformLocale(locale, [open, close]) {
+ const i18nOpen = `__${open}__`
+ const i18nClose = `__${close}__`
+ if (locale.includes(i18nOpen)) {
+ locale = locale.replace(i18nOpen, '<0>').replace(i18nClose, '0>')
+ }
+ return locale
+}
+
+function main() {
+ transformLocales(MAPPING, transformLocale)
+}
+
+if (require.main === module) {
+ main()
+}
diff --git a/services/web/scripts/translations/transformLocales.js b/services/web/scripts/translations/transformLocales.js
new file mode 100644
index 0000000000..601c54c789
--- /dev/null
+++ b/services/web/scripts/translations/transformLocales.js
@@ -0,0 +1,49 @@
+const fs = require('fs')
+
+const LANGUAGES = [
+ 'cs',
+ 'da',
+ 'de',
+ 'en',
+ 'es',
+ 'fi',
+ 'fr',
+ 'it',
+ 'ja',
+ 'ko',
+ 'nl',
+ 'no',
+ 'pl',
+ 'pt',
+ 'ru',
+ 'sv',
+ 'tr',
+ 'zh-CN'
+]
+const LOCALES = {}
+LANGUAGES.forEach(loadLocales)
+function loadLocales(language) {
+ LOCALES[language] = require(`../../locales/${language}.json`)
+}
+
+function transformLocales(mapping, transformLocale) {
+ Object.entries(LOCALES).forEach(([language, translatedLocales]) => {
+ Object.entries(mapping).forEach(([localeKey, spec]) => {
+ const locale = translatedLocales[localeKey]
+ if (!locale) {
+ // This locale is not translated yet.
+ return
+ }
+ translatedLocales[localeKey] = transformLocale(locale, spec)
+ })
+
+ fs.writeFileSync(
+ `${__dirname}/../../locales/${language}.json`,
+ JSON.stringify(translatedLocales, null, 2) + '\n'
+ )
+ })
+}
+
+module.exports = {
+ transformLocales
+}