Skip to content

Commit

Permalink
Merge pull request #18705 from Snuffleupagus/ColorPicker-full-l10n-ids
Browse files Browse the repository at this point in the history
Use "full" localization ids in the `ColorPicker` class (PR 18674 follow-up)
  • Loading branch information
Snuffleupagus authored Sep 7, 2024
2 parents 5369a24 + 9310903 commit 7274546
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/display/editor/color_picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class ColorPicker {

#type;

static #l10nColor = null;

static get _keyboardManager() {
return shadow(
this,
Expand Down Expand Up @@ -81,6 +83,14 @@ class ColorPicker {
editor?.color ||
this.#uiManager?.highlightColors.values().next().value ||
"#FFFF98";

ColorPicker.#l10nColor ||= Object.freeze({
blue: "pdfjs-editor-colorpicker-blue",
green: "pdfjs-editor-colorpicker-green",
pink: "pdfjs-editor-colorpicker-pink",
red: "pdfjs-editor-colorpicker-red",
yellow: "pdfjs-editor-colorpicker-yellow",
});
}

renderButton() {
Expand Down Expand Up @@ -123,7 +133,7 @@ class ColorPicker {
button.role = "option";
button.setAttribute("data-color", color);
button.title = name;
button.setAttribute("data-l10n-id", `pdfjs-editor-colorpicker-${name}`);
button.setAttribute("data-l10n-id", ColorPicker.#l10nColor[name]);
const swatch = document.createElement("span");
button.append(swatch);
swatch.className = "swatch";
Expand Down

0 comments on commit 7274546

Please sign in to comment.