diff --git a/client/src/components/plugins/localization.js b/client/src/components/plugins/localization.js index cf6c196778b..896cb6756fd 100644 --- a/client/src/components/plugins/localization.js +++ b/client/src/components/plugins/localization.js @@ -12,11 +12,14 @@ function localizeDirective(l) { // TODO consider using a different hook if we need dynamic updates in content translation bind(el, binding, vnode) { el.childNodes.forEach((node) => { + // trim for lookup, but put back whitespace after + const leadingSpace = node.textContent.match(/^\s*/)[0]; + const trailingSpace = node.textContent.match(/\s*$/)[0]; const standardizedContent = node.textContent .replace(newlineMatch, " ") .replace(doublespaces, " ") .trim(); - node.textContent = l(standardizedContent); + node.textContent = leadingSpace + l(standardizedContent) + trailingSpace; }); }, };