Make t function return a span element with a lang attribute unless html: false is specified in the options (re: #7963)

Update `text` functions to `html` to support inserting the `span` elements
Specify `html: false` for various instances where a `span` is not desired, e.g. `placeholder` and `title` attributes
This commit is contained in:
Quincy Morgan
2020-09-15 21:56:22 -04:00
parent 7aa6c1d1a3
commit 32f8274929
150 changed files with 471 additions and 463 deletions
+11 -11
View File
@@ -54,7 +54,7 @@ export function uiNoteEditor(context) {
headerEnter
.append('h3')
.text(t('note.title'));
.html(t('note.title'));
var body = selection.selectAll('.body')
@@ -148,14 +148,14 @@ export function uiNoteEditor(context) {
noteSaveEnter
.append('h4')
.attr('class', '.note-save-header')
.text(function() {
.html(function() {
return _note.isNew() ? t('note.newDescription') : t('note.newComment');
});
var commentTextarea = noteSaveEnter
.append('textarea')
.attr('class', 'new-comment-input')
.attr('placeholder', t('note.inputPlaceholder'))
.attr('placeholder', t('note.inputPlaceholder', { html: false }))
.attr('maxlength', 1000)
.property('value', function(d) { return d.newComment; })
.call(utilNoAuto)
@@ -256,14 +256,14 @@ export function uiNoteEditor(context) {
authEnter
.append('span')
.text(t('note.login'));
.html(t('note.login'));
authEnter
.append('a')
.attr('target', '_blank')
.call(svgIcon('#iD-icon-out-link', 'inline'))
.append('span')
.text(t('login'))
.html(t('login'))
.on('click.note-login', function() {
d3_event.preventDefault();
osm.authenticate();
@@ -284,7 +284,7 @@ export function uiNoteEditor(context) {
prose = prose.enter()
.append('p')
.attr('class', 'note-save-prose')
.text(t('note.upload_explanation'))
.html(t('note.upload_explanation'))
.merge(prose);
osm.userDetails(function(err, user) {
@@ -302,7 +302,7 @@ export function uiNoteEditor(context) {
userLink
.append('a')
.attr('class', 'user-info')
.text(user.display_name)
.html(user.display_name)
.attr('href', osm.userURL(user.display_name))
.attr('tabindex', -1)
.attr('target', '_blank');
@@ -334,12 +334,12 @@ export function uiNoteEditor(context) {
buttonEnter
.append('button')
.attr('class', 'button cancel-button secondary-action')
.text(t('confirm.cancel'));
.html(t('confirm.cancel'));
buttonEnter
.append('button')
.attr('class', 'button save-button action')
.text(t('note.save'));
.html(t('note.save'));
} else {
buttonEnter
@@ -349,7 +349,7 @@ export function uiNoteEditor(context) {
buttonEnter
.append('button')
.attr('class', 'button comment-button action')
.text(t('note.comment'));
.html(t('note.comment'));
}
@@ -366,7 +366,7 @@ export function uiNoteEditor(context) {
buttonSection.select('.status-button') // select and propagate data
.attr('disabled', (hasAuth ? null : true))
.text(function(d) {
.html(function(d) {
var action = (d.status === 'open' ? 'close' : 'open');
var andComment = (d.newComment ? '_comment' : '');
return t('note.' + action + andComment);