mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-21 13:50:20 +08:00
Merge pull request #18005 from dannon/fix-localization-spacing
[24.0] Preserve surrounding whitespace when localizing complex nodes
This commit is contained in:
@@ -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;
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user