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