mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Use "full" localization ids throughout the code-base
It was recently brought to my attention that using partial or generated localization ids is bad for maintainability, hence this patch goes through the code-base and replaces any such occurrences.
This commit is contained in:
parent
7494dbccf4
commit
b01df28810
4 changed files with 24 additions and 10 deletions
|
@ -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() {
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class PasswordPrompt {
|
|||
}
|
||||
this.label.setAttribute(
|
||||
"data-l10n-id",
|
||||
`pdfjs-password-${passwordIncorrect ? "invalid" : "label"}`
|
||||
passwordIncorrect ? "pdfjs-password-invalid" : "pdfjs-password-label"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue