Skip to content
Snippets Groups Projects
Commit dc93cfdc authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2052973 by Mark Carver, nod_, hass: Fixed Improve translatability of strings in toolbar.js.

parent 99575b2b
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -15,8 +15,6 @@ var options = $.extend({
'module.toolbar.wide': ''
},
strings: {
opened: Drupal.t('opened'),
closed: Drupal.t('closed'),
horizontal: Drupal.t('Horizontal orientation'),
vertical: Drupal.t('Vertical orientation')
}
......@@ -273,11 +271,15 @@ Drupal.toolbar = {
*/
onActiveTrayChange: function (model, tray) {
var relevantTray = (tray === null) ? model.previous('activeTray') : tray;
var state = (tray === null) ? this.strings.closed : this.strings.opened;
Drupal.announce(Drupal.t('"@tray" tray @state.', {
'@tray': relevantTray.querySelector('.toolbar-tray-name').textContent,
'@state': state
}));
var trayName = relevantTray.querySelector('.toolbar-tray-name').textContent;
var text;
if (tray === null) {
text = Drupal.t('Tray "@tray" closed.', { '@tray': trayName });
}
else {
text = Drupal.t('Tray "@tray" opened.', { '@tray': trayName });
}
Drupal.announce(text);
}
}),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment