make import report messages localizable
This commit is contained in:
parent
470bc92da5
commit
e6f2034e64
|
@ -234,6 +234,46 @@
|
|||
"message": "Type a command name",
|
||||
"description": "Placeholder text of inputbox in keymap help popup on the edit style page. Must be very short"
|
||||
},
|
||||
"importReportLegendAdded": {
|
||||
"message": "added",
|
||||
"description": "Text after the number of styles added in the report shown after importing styles"
|
||||
},
|
||||
"importReportLegendIdentical": {
|
||||
"message": "identical skipped",
|
||||
"description": "Text after the number of styles skipped due to being identical to the already installed ones in the report shown after importing styles"
|
||||
},
|
||||
"importReportLegendInvalid": {
|
||||
"message": "invalid skipped",
|
||||
"description": "Text after the number of styles skipped due to being invalid (not a Stylus/Stylish backup file probably) in the report shown after importing styles"
|
||||
},
|
||||
"importReportLegendUpdatedBoth": {
|
||||
"message": "updated both meta info and code",
|
||||
"description": "Text after the number of styles updated entirely in the report shown after importing styles"
|
||||
},
|
||||
"importReportLegendUpdatedCode": {
|
||||
"message": "updated code",
|
||||
"description": "Text after the number of styles with updated code (meta info is unchanged) in the report shown after importing styles"
|
||||
},
|
||||
"importReportLegendUpdatedMeta": {
|
||||
"message": "updated meta info",
|
||||
"description": "Text after the number of styles with updated meta info like name/url in the report shown after importing styles"
|
||||
},
|
||||
"importReportTitle": {
|
||||
"message": "Finished importing styles",
|
||||
"description": "Title of the report shown after importing styles"
|
||||
},
|
||||
"importReportUnchanged": {
|
||||
"message": "Nothing was changed.",
|
||||
"description": "Message in the report shown after importing styles"
|
||||
},
|
||||
"importReportUndoneTitle": {
|
||||
"message": "Import has been undone",
|
||||
"description": "Title of the message box shown after undoing the import of styles"
|
||||
},
|
||||
"importReportUndone": {
|
||||
"message": "styles were reverted",
|
||||
"description": "Text after the number of styles reverted in the message box shown after undoing the import of styles"
|
||||
},
|
||||
"importLabel": {
|
||||
"message": "Import",
|
||||
"description": "Label for the button to import a style ('edit' page) or all styles ('manage' page)"
|
||||
|
|
|
@ -59,12 +59,12 @@ function importFromString(jsonString) {
|
|||
const oldStylesByName = json.length && new Map(
|
||||
oldStyles.map(style => [style.name.trim(), style]));
|
||||
const stats = {
|
||||
added: {names: [], ids: [], legend: 'added'},
|
||||
unchanged: {names: [], ids: [], legend: 'identical skipped'},
|
||||
metaAndCode: {names: [], ids: [], legend: 'updated both meta info and code'},
|
||||
metaOnly: {names: [], ids: [], legend: 'updated meta info'},
|
||||
codeOnly: {names: [], ids: [], legend: 'updated code'},
|
||||
invalid: {names: [], legend: 'invalid skipped'},
|
||||
added: {names: [], ids: [], legend: 'importReportLegendAdded'},
|
||||
unchanged: {names: [], ids: [], legend: 'importReportLegendIdentical'},
|
||||
metaAndCode: {names: [], ids: [], legend: 'importReportLegendUpdatedBoth'},
|
||||
metaOnly: {names: [], ids: [], legend: 'importReportLegendUpdatedMeta'},
|
||||
codeOnly: {names: [], ids: [], legend: 'importReportLegendUpdatedCode'},
|
||||
invalid: {names: [], legend: 'importReportLegendInvalid'},
|
||||
};
|
||||
let index = 0;
|
||||
let lastRenderTime = performance.now();
|
||||
|
@ -153,14 +153,14 @@ function importFromString(jsonString) {
|
|||
.filter(kind => stats[kind].names.length)
|
||||
.map(kind =>
|
||||
`<details data-id="${kind}">
|
||||
<summary><b>${stats[kind].names.length} ${stats[kind].legend}</b></summary>
|
||||
<summary><b>${stats[kind].names.length} ${t(stats[kind].legend)}</b></summary>
|
||||
<small>${listNames(kind).join('')}</small>
|
||||
</details>`)
|
||||
.join('');
|
||||
scrollTo(0, 0);
|
||||
messageBox({
|
||||
title: 'Finished importing styles',
|
||||
contents: report || 'Nothing was changed.',
|
||||
title: t('importReportTitle'),
|
||||
contents: report || t('importReportUnchanged'),
|
||||
buttons: [t('confirmOK'), numChanged && t('undo')],
|
||||
onshow: bindClick,
|
||||
}).then(({button, enter, esc}) => {
|
||||
|
@ -184,8 +184,8 @@ function importFromString(jsonString) {
|
|||
return new Promise(undoNextId)
|
||||
.then(BG.refreshAllTabs)
|
||||
.then(() => messageBox({
|
||||
title: 'Import has been undone',
|
||||
contents: newIds.length + ' styles were reverted.',
|
||||
title: t('importReportUndoneTitle'),
|
||||
contents: newIds.length + ' ' + t('importReportUndone'),
|
||||
buttons: [t('confirmOK')],
|
||||
}));
|
||||
function undoNextId(resolve) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user