[Editor] Fix the button labels in the comment dialog (bug 1990499)

This commit is contained in:
Calixte Denizet 2025-09-24 18:18:43 +02:00
parent 83b5e9efb0
commit 7b67ed3454
3 changed files with 22 additions and 8 deletions

View File

@ -684,15 +684,16 @@ pdfjs-editor-delete-comment-popup-button =
# An existing comment is edited
pdfjs-editor-edit-comment-dialog-title-when-editing = Edit comment
pdfjs-editor-edit-comment-dialog-save-button-when-editing = Update
# No existing comment
pdfjs-editor-edit-comment-dialog-title-when-adding = Add comment
pdfjs-editor-edit-comment-dialog-save-button-when-adding = Add
pdfjs-editor-edit-comment-dialog-text-input =
.placeholder = Start typing…
pdfjs-editor-edit-comment-dialog-cancel-button = Cancel
pdfjs-editor-edit-comment-dialog-save-button = Save
## Edit a comment button in the editor toolbar

View File

@ -681,12 +681,25 @@ class CommentDialog {
this.#commentText = str || "";
const textInput = this.#textInput;
textInput.value = this.#previousText = this.#commentText;
this.#title.setAttribute(
"data-l10n-id",
str
? "pdfjs-editor-edit-comment-dialog-title-when-editing"
: "pdfjs-editor-edit-comment-dialog-title-when-adding"
);
if (str) {
this.#title.setAttribute(
"data-l10n-id",
"pdfjs-editor-edit-comment-dialog-title-when-editing"
);
this.#saveButton.setAttribute(
"data-l10n-id",
"pdfjs-editor-edit-comment-dialog-save-button-when-editing"
);
} else {
this.#title.setAttribute(
"data-l10n-id",
"pdfjs-editor-edit-comment-dialog-title-when-adding"
);
this.#saveButton.setAttribute(
"data-l10n-id",
"pdfjs-editor-edit-comment-dialog-save-button-when-adding"
);
}
if (options?.height) {
textInput.style.height = `${options.height}px`;
}

View File

@ -803,7 +803,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<span data-l10n-id="pdfjs-editor-edit-comment-dialog-cancel-button"></span>
</button>
<button id="commentManagerSaveButton" type="button" class="primaryButton" disabled tabindex="0">
<span data-l10n-id="pdfjs-editor-edit-comment-dialog-save-button"></span>
<span data-l10n-id="pdfjs-editor-edit-comment-dialog-save-button-when-adding"></span>
</button>
</div>
</div>