Skip to content

Commit

Permalink
Merge pull request #18674 from Snuffleupagus/full-l10n-ids
Browse files Browse the repository at this point in the history
Use "full" localization ids throughout the code-base
  • Loading branch information
Snuffleupagus authored Sep 1, 2024
2 parents ff76217 + b01df28 commit 2a68aa6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
20 changes: 14 additions & 6 deletions src/display/editor/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@ class EditorToolbar {

#altText = null;

static #l10nRemove = null;

constructor(editor) {
this.#editor = editor;

EditorToolbar.#l10nRemove ||= Object.freeze({
freetext: "pdfjs-editor-remove-freetext-button",
highlight: "pdfjs-editor-remove-highlight-button",
ink: "pdfjs-editor-remove-ink-button",
stamp: "pdfjs-editor-remove-stamp-button",
});
}

render() {
Expand Down Expand Up @@ -105,20 +114,19 @@ class EditorToolbar {
}

#addDeleteButton() {
const { editorType, _uiManager } = this.#editor;

const button = document.createElement("button");
button.className = "delete";
button.tabIndex = 0;
button.setAttribute(
"data-l10n-id",
`pdfjs-editor-remove-${this.#editor.editorType}-button`
);
button.setAttribute("data-l10n-id", EditorToolbar.#l10nRemove[editorType]);
this.#addListenersToElement(button);
button.addEventListener(
"click",
e => {
this.#editor._uiManager.delete();
_uiManager.delete();
},
{ signal: this.#editor._uiManager._signal }
{ signal: _uiManager._signal }
);
this.#buttons.append(button);
}
Expand Down
4 changes: 3 additions & 1 deletion web/new_alt_text_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ class NewAltTextManager {
this.#isEditing = isEditing;
this.#title.setAttribute(
"data-l10n-id",
`pdfjs-editor-new-alt-text-dialog-${isEditing ? "edit" : "add"}-label`
isEditing
? "pdfjs-editor-new-alt-text-dialog-edit-label"
: "pdfjs-editor-new-alt-text-dialog-add-label"
);
}

Expand Down
2 changes: 1 addition & 1 deletion web/password_prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class PasswordPrompt {
}
this.label.setAttribute(
"data-l10n-id",
`pdfjs-password-${passwordIncorrect ? "invalid" : "label"}`
passwordIncorrect ? "pdfjs-password-invalid" : "pdfjs-password-label"
);
}

Expand Down
8 changes: 6 additions & 2 deletions web/pdf_find_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ class PDFFindBar {
status = "notFound";
break;
case FindState.WRAPPED:
findMsgId = `pdfjs-find-reached-${previous ? "top" : "bottom"}`;
findMsgId = previous
? "pdfjs-find-reached-top"
: "pdfjs-find-reached-bottom";
break;
}
findField.setAttribute("data-status", status);
Expand All @@ -148,7 +150,9 @@ class PDFFindBar {

findResultsCount.setAttribute(
"data-l10n-id",
`pdfjs-find-match-count${total > limit ? "-limit" : ""}`
total > limit
? "pdfjs-find-match-count-limit"
: "pdfjs-find-match-count"
);
findResultsCount.setAttribute(
"data-l10n-args",
Expand Down

0 comments on commit 2a68aa6

Please sign in to comment.