From 931090328d520ad2b216d4f952424785b019ae97 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 7 Sep 2024 15:51:21 +0200 Subject: [PATCH] Use "full" localization ids in the `ColorPicker` class (PR 18674 follow-up) Apparently I missed these in PR 18674. --- src/display/editor/color_picker.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/display/editor/color_picker.js b/src/display/editor/color_picker.js index 9550145205674..c4d5811eaed76 100644 --- a/src/display/editor/color_picker.js +++ b/src/display/editor/color_picker.js @@ -42,6 +42,8 @@ class ColorPicker { #type; + static #l10nColor = null; + static get _keyboardManager() { return shadow( this, @@ -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() { @@ -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";