Skip to content

Commit

Permalink
Add localization for 'Copy' and 'Move' actions
Browse files Browse the repository at this point in the history
  • Loading branch information
moisseev committed Jul 28, 2024
1 parent f6c149a commit bff233e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
6 changes: 6 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"description": "Name of the extension.",
"message": "Rspamd-spamness"
},
"spamness.action.label.copy": {
"message": "Copy"
},
"spamness.action.label.move": {
"message": "Move"
},
"spamness.alertText.colonInHeaderName": {
"message": "The header you entered contains an invalid character, such as ':', a non-printable character, a non-ascii character, or an eight bit ascii character. Please remove the invalid character and try again."
},
Expand Down
6 changes: 6 additions & 0 deletions _locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
"description": "Description of the extension.",
"message": "Дополнение позволяет наглядно отображать результаты обработки сообщения антиспам-системой Rspamd."
},
"spamness.action.label.copy": {
"message": "Копировать"
},
"spamness.action.label.move": {
"message": "Переместить"
},
"spamness.alertText.colonInHeaderName": {
"message": "Введённый заголовок содержит запрещённый символ, например, «:»; непечатаемый символ; символ, не входящий в таблицу ASCII, или восьмибитный ASCII-символ. Удалите этот символ и попробуйте снова."
},
Expand Down
15 changes: 7 additions & 8 deletions experiments/trainButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,15 @@ var trainButtons = class extends ExtensionCommon.ExtensionAPI {

const menupopup = document.createXULElement("menupopup");

const moveItem = document.createXULElement("menuitem");
moveItem.setAttribute("label", "Move");
moveItem.setAttribute("data-action", "move");
["move", "copy"].forEach((action) => {
const item = document.createXULElement("menuitem");
const itemLabel = context.extension.localeData.localizeMessage("spamness.action.label." + action);
item.setAttribute("label", itemLabel);
item.setAttribute("data-action", action);

const copyItem = document.createXULElement("menuitem");
copyItem.setAttribute("label", "Copy");
copyItem.setAttribute("data-action", "copy");
menupopup.appendChild(item);
});

menupopup.appendChild(moveItem);
menupopup.appendChild(copyItem);
toolbarbutton.appendChild(menupopup);

dropmarker.addEventListener("click", (event) => {
Expand Down
8 changes: 4 additions & 4 deletions options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@
<div>
<label for="trainingButtonHamDefaultAction">__MSG_spamness.buttonTrainHam.label__</label>
<select name="default-action-menupopup" id="trainingButtonHamDefaultAction">
<option value="move">Move</option>
<option value="copy">Copy</option>
<option value="move">__MSG_spamness.action.label.move__</option>
<option value="copy">__MSG_spamness.action.label.copy__</option>
</select>
</div>
<div>
<label for="trainingButtonSpamDefaultAction">__MSG_spamness.buttonTrainSpam.label__</label>
<select name="default-action-menupopup" id="trainingButtonSpamDefaultAction">
<option value="move">Move</option>
<option value="copy">Copy</option>
<option value="move">__MSG_spamness.action.label.move__</option>
<option value="copy">__MSG_spamness.action.label.copy__</option>
</select>
</div>
<spacer/>
Expand Down

0 comments on commit bff233e

Please sign in to comment.