statusbar: better strings formatting
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com> Change-Id: I7c5d5cbd2e36e6391610f8d4b18a87bf32c9dde2pull/8807/head
parent
81b00e7376
commit
c7dd10a877
|
@ -162,7 +162,7 @@ class StatusBar extends JSDialog.Toolbar {
|
|||
onPageChange(e) {
|
||||
var state = e.state;
|
||||
state = this.toLocalePattern('Page %1 of %2', 'Page (\\d+) of (\\d+)', state, '%1', '%2');
|
||||
this.updateHtmlItem('StatePageNumber', state ? state : '  ');
|
||||
this.updateHtmlItem('StatePageNumber', state ? state : ' ');
|
||||
}
|
||||
|
||||
_generateHtmlItem(id) {
|
||||
|
@ -173,7 +173,7 @@ class StatusBar extends JSDialog.Toolbar {
|
|||
type: 'container',
|
||||
id: id + '-container',
|
||||
children: [
|
||||
{type: 'htmlcontent', id: id, htmlId: id, text: '  ', isReadOnlyMode: isReadOnlyMode, canUserWrite: canUserWrite},
|
||||
{type: 'htmlcontent', id: id, htmlId: id, text: ' ', isReadOnlyMode: isReadOnlyMode, canUserWrite: canUserWrite},
|
||||
{type: 'separator', id: id + 'break', orientation: 'vertical'}
|
||||
],
|
||||
vertical: false,
|
||||
|
@ -406,7 +406,7 @@ class StatusBar extends JSDialog.Toolbar {
|
|||
|
||||
if (commandName === '.uno:StatusDocPos') {
|
||||
state = this.toLocalePattern('Sheet %1 of %2', 'Sheet (\\d+) of (\\d+)', state, '%1', '%2');
|
||||
this.updateHtmlItem('StatusDocPos', state ? state : '  ');
|
||||
this.updateHtmlItem('StatusDocPos', state ? state : ' ');
|
||||
}
|
||||
else if (commandName === '.uno:LanguageStatus') {
|
||||
var language = this.extractLanguageFromStatus(state);
|
||||
|
@ -415,10 +415,10 @@ class StatusBar extends JSDialog.Toolbar {
|
|||
else if (commandName === '.uno:RowColSelCount') {
|
||||
state = this.toLocalePattern('$1 rows, $2 columns selected', '(\\d+) rows, (\\d+) columns selected', state, '$1', '$2');
|
||||
state = this.toLocalePattern('$1 of $2 records found', '(\\d+) of (\\d+) records found', state, '$1', '$2');
|
||||
this.updateHtmlItem('RowColSelCount', state ? state : ' ' + _('Select multiple cells') + ' ');
|
||||
this.updateHtmlItem('RowColSelCount', state ? state : _('Select multiple cells'));
|
||||
}
|
||||
else if (commandName === '.uno:InsertMode') {
|
||||
this.updateHtmlItem('InsertMode', state ? L.Styles.insertMode[state].toLocaleString() : ' ' + _('Insert mode: inactive') + ' ');
|
||||
this.updateHtmlItem('InsertMode', state ? L.Styles.insertMode[state].toLocaleString() : _('Insert mode: inactive'));
|
||||
|
||||
$('#InsertMode').removeClass();
|
||||
$('#InsertMode').addClass('cool-font insert-mode-' + state);
|
||||
|
@ -430,10 +430,10 @@ class StatusBar extends JSDialog.Toolbar {
|
|||
}
|
||||
}
|
||||
else if (commandName === '.uno:StatusSelectionMode' || commandName === '.uno:SelectionMode') {
|
||||
this.updateHtmlItem('StatusSelectionMode', state ? L.Styles.selectionMode[state].toLocaleString() : ' ' + _('Selection mode: inactive') + ' ');
|
||||
this.updateHtmlItem('StatusSelectionMode', state ? L.Styles.selectionMode[state].toLocaleString() : _('Selection mode: inactive'));
|
||||
}
|
||||
else if (commandName == '.uno:StateTableCell') {
|
||||
this.updateHtmlItem('StateTableCell', state ? this.localizeStateTableCell(state) : '  ');
|
||||
this.updateHtmlItem('StateTableCell', state ? this.localizeStateTableCell(state) : ' ');
|
||||
}
|
||||
else if (commandName === '.uno:StatusBarFunc') {
|
||||
if (app.map.isReadOnlyMode())
|
||||
|
@ -452,15 +452,15 @@ class StatusBar extends JSDialog.Toolbar {
|
|||
}
|
||||
else if (commandName === '.uno:StateWordCount') {
|
||||
state = this.toLocalePattern('%1 words, %2 characters', '([\\d,]+) words, ([\\d,]+) characters', state, '%1', '%2');
|
||||
this.updateHtmlItem('StateWordCount', state ? state : '  ');
|
||||
this.updateHtmlItem('StateWordCount', state ? state : ' ');
|
||||
}
|
||||
else if (commandName === '.uno:PageStatus') {
|
||||
if (this.map.getDocType() === 'presentation') {
|
||||
state = this.toLocalePattern('Slide %1 of %2', 'Slide (\\d+) of (\\d+)', state, '%1', '%2');
|
||||
this.updateHtmlItem('SlideStatus', state ? state : '  ');
|
||||
this.updateHtmlItem('SlideStatus', state ? state : ' ');
|
||||
} else {
|
||||
state = this.toLocalePattern('Page %1 of %2', 'Slide (\\d+) of (\\d+)', state, '%1', '%2');
|
||||
this.updateHtmlItem('PageStatus', state ? state : '  ');
|
||||
this.updateHtmlItem('PageStatus', state ? state : ' ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,14 +26,20 @@ interface HtmlContentJson {
|
|||
text: string | undefined;
|
||||
}
|
||||
|
||||
function sanitizeString(text: string): string {
|
||||
const sanitizer = document.createElement('div');
|
||||
sanitizer.innerText = text;
|
||||
return sanitizer.innerHTML;
|
||||
}
|
||||
|
||||
function getPermissionModeHtml(isReadOnlyMode: boolean, canUserWrite: boolean) {
|
||||
var permissionModeDiv = '<div id="PermissionMode" class="cool-font jsdialog ';
|
||||
if (isReadOnlyMode && !canUserWrite) {
|
||||
permissionModeDiv +=
|
||||
' status-readonly-mode" title="' +
|
||||
_('Permission Mode') +
|
||||
sanitizeString(_('Permission Mode')) +
|
||||
'" style="padding: 5px 5px;"> ' +
|
||||
_('Read-only') +
|
||||
sanitizeString(_('Read-only')) +
|
||||
' </div>';
|
||||
} else if (isReadOnlyMode && canUserWrite) {
|
||||
permissionModeDiv +=
|
||||
|
@ -41,9 +47,9 @@ function getPermissionModeHtml(isReadOnlyMode: boolean, canUserWrite: boolean) {
|
|||
} else {
|
||||
permissionModeDiv +=
|
||||
' status-edit-mode" title="' +
|
||||
_('Permission Mode') +
|
||||
sanitizeString(_('Permission Mode')) +
|
||||
'" style="padding: 5px 5px;"> ' +
|
||||
_('Edit') +
|
||||
sanitizeString(_('Edit')) +
|
||||
' </div>';
|
||||
}
|
||||
return permissionModeDiv;
|
||||
|
@ -52,11 +58,11 @@ function getPermissionModeHtml(isReadOnlyMode: boolean, canUserWrite: boolean) {
|
|||
function getStatusbarItemHtml(id: string, title: string, text: string) {
|
||||
return (
|
||||
'<div id="' +
|
||||
id +
|
||||
sanitizeString(id) +
|
||||
'" class="cool-font" title="' +
|
||||
title +
|
||||
sanitizeString(title) +
|
||||
'" style="padding: 5px 5px;">' +
|
||||
text +
|
||||
sanitizeString(text) +
|
||||
'</div>'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -29,19 +29,19 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Statubar tests.', function
|
|||
});
|
||||
|
||||
it('Multiple cell selection.', function() {
|
||||
cy.cGet('#RowColSelCount').should('have.text', '\u00a0Select multiple cells\u00a0');
|
||||
cy.cGet('#RowColSelCount').should('have.text', 'Select multiple cells');
|
||||
helper.typeIntoInputField('input#addressInput', 'A1:A2');
|
||||
cy.cGet('#RowColSelCount').should('have.text', 'Selected: 2 rows, 1 column');
|
||||
helper.typeIntoInputField('input#addressInput', 'A1');
|
||||
cy.cGet('#RowColSelCount').should('have.text', '\u00a0Select multiple cells\u00a0');
|
||||
cy.cGet('#RowColSelCount').should('have.text', 'Select multiple cells');
|
||||
});
|
||||
|
||||
it('Text editing mode.', function() {
|
||||
cy.cGet('#InsertMode').should('have.text', '\u00a0Insert mode: inactive\u00a0');
|
||||
cy.cGet('#InsertMode').should('have.text', 'Insert mode: inactive');
|
||||
calcHelper.dblClickOnFirstCell();
|
||||
cy.cGet('#InsertMode').should('have.text', 'Insert');
|
||||
calcHelper.typeIntoFormulabar('{enter}');
|
||||
cy.cGet('#InsertMode').should('have.text', '\u00a0Insert mode: inactive\u00a0');
|
||||
cy.cGet('#InsertMode').should('have.text', 'Insert mode: inactive');
|
||||
});
|
||||
|
||||
it('Selected data summary.', function() {
|
||||
|
|
|
@ -19,11 +19,11 @@ describe(['tagmultiuser'], 'Joining a document should not trigger an invalidatio
|
|||
it('Join document', function() {
|
||||
cy.cSetActiveFrame('#iframe1');
|
||||
|
||||
cy.cGet('#InsertMode').should('have.text', '\u00a0Insert mode: inactive\u00a0');
|
||||
cy.cGet('#InsertMode').should('have.text', 'Insert mode: inactive');
|
||||
helper.typeIntoDocument('X');
|
||||
cy.cGet('#InsertMode').should('have.text', 'Insert');
|
||||
helper.typeIntoDocument('{enter}');
|
||||
cy.cGet('#InsertMode').should('have.text', '\u00a0Insert mode: inactive\u00a0');
|
||||
cy.cGet('#InsertMode').should('have.text', 'Insert mode: inactive');
|
||||
cy.cGet('input#addressInput').should('have.prop', 'value', 'A2');
|
||||
helper.typeIntoDocument('{uparrow}');
|
||||
// wait until round trip of cell address
|
||||
|
|
Loading…
Reference in New Issue