mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #12580 from dannon/localize-directive-improvement
Update localization directive to trim whitepsace around text content.
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
</template>
|
||||
|
||||
<b-dropdown-item @click.stop="$emit('delete')">
|
||||
<span v-localize>Delete Collection Only </span>
|
||||
<span v-localize>Delete Collection Only</span>
|
||||
</b-dropdown-item>
|
||||
|
||||
<b-dropdown-item @click.stop="$emit('delete', { recursive: true })">
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<span class="fa fa-cubes" />
|
||||
</template>
|
||||
<b-dropdown-item v-for="v of availableVersions" :key="v" @click="$emit('onChangeVersion', v)">
|
||||
<span class="fa fa-cube" /><span v-localize>Switch to </span>{{ v }}</b-dropdown-item
|
||||
<span class="fa fa-cube" /><span v-localize>Switch to</span> {{ v }}</b-dropdown-item
|
||||
>
|
||||
</b-dropdown>
|
||||
<b-button
|
||||
|
||||
@@ -8,11 +8,11 @@ const newlineMatch = /\r?\n|\r/g;
|
||||
const doublespaces = /\s\s+/g;
|
||||
|
||||
const localizeDirective = {
|
||||
// TODO consider using a different hook if we need dynamic updates in content translation
|
||||
bind(el, binding, vnode) {
|
||||
el.childNodes.forEach((node) => {
|
||||
const oneline = node.textContent.replace(newlineMatch, " ");
|
||||
const singleSpaces = oneline.replace(doublespaces, " ");
|
||||
node.textContent = _l(singleSpaces);
|
||||
const standardizedContent = node.textContent.replace(newlineMatch, " ").replace(doublespaces, " ").trim();
|
||||
node.textContent = _l(standardizedContent);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user