From 7b4dac34928b70adf1f67481854329fff3838e46 Mon Sep 17 00:00:00 2001 From: Stoyan <88034608+hinzzx@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:20:54 +0200 Subject: [PATCH] fix(ui5-color-palette): add i18n text for default color button's text (#8157) Currently in our `` and `` components the *'More Colors...'* button have its text in the i18n Bundle, while in the *'Default Color'* button the text was hardcoded, which is inconsistent and leads to a non-translated text in different regions. - With this change we added the text of the *'Default Color'* button in the I18N Bundle. --- packages/main/src/ColorPalette.hbs | 4 ++-- packages/main/src/ColorPalette.ts | 7 ++++++- packages/main/src/i18n/messagebundle.properties | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/main/src/ColorPalette.hbs b/packages/main/src/ColorPalette.hbs index 632cdd308120..48f95a120a22 100644 --- a/packages/main/src/ColorPalette.hbs +++ b/packages/main/src/ColorPalette.hbs @@ -10,7 +10,7 @@ class="ui5-cp-default-color-button" design="Transparent" @click={{_onDefaultColorClick}} - @keydown={{_onDefaultColorKeyDown}}>Default color + @keydown={{_onDefaultColorKeyDown}}>{{colorPaletteDefaultColorText}}
{{/if}} @@ -35,7 +35,7 @@ class="ui5-cp-more-colors" @click="{{_openMoreColorsDialog}}" @keydown={{_onMoreColorsKeyDown}} - >{{colorPaleteMoreColorsText}} + >{{colorPaletteMoreColorsText}} {{/if}} diff --git a/packages/main/src/ColorPalette.ts b/packages/main/src/ColorPalette.ts index 3bc7be899b94..ebd213e964bf 100644 --- a/packages/main/src/ColorPalette.ts +++ b/packages/main/src/ColorPalette.ts @@ -30,6 +30,7 @@ import type { IColorPaletteItem } from "./Interfaces.js"; import { COLORPALETTE_CONTAINER_LABEL, COLOR_PALETTE_MORE_COLORS_TEXT, + COLOR_PALETTE_DEFAULT_COLOR_TEXT, } from "./generated/i18n/i18n-defaults.js"; // Styles @@ -422,10 +423,14 @@ class ColorPalette extends UI5Element { return ColorPalette.i18nBundle.getText(COLORPALETTE_CONTAINER_LABEL); } - get colorPaleteMoreColorsText() { + get colorPaletteMoreColorsText() { return ColorPalette.i18nBundle.getText(COLOR_PALETTE_MORE_COLORS_TEXT); } + get colorPaletteDefaultColorText() { + return ColorPalette.i18nBundle.getText(COLOR_PALETTE_DEFAULT_COLOR_TEXT); + } + get _showMoreColors() { return this.showMoreColors && this.moreColorsFeature; } diff --git a/packages/main/src/i18n/messagebundle.properties b/packages/main/src/i18n/messagebundle.properties index 74555ec5c948..11bc9e5d242e 100644 --- a/packages/main/src/i18n/messagebundle.properties +++ b/packages/main/src/i18n/messagebundle.properties @@ -106,9 +106,12 @@ COLOR_PALETTE_DIALOG_OK_BUTTON=OK #XTIT: Color Palette dialog title of the Color Picker COLOR_PALETTE_DIALOG_TITLE=Change Color -#XTIT: Color Palette dialog title of the Color Picker +#XTIT: Color Palette dialog button text to open the Color Picker COLOR_PALETTE_MORE_COLORS_TEXT=More Colors... +#XTIT: Color Palette dialog button text to set the default color +COLOR_PALETTE_DEFAULT_COLOR_TEXT=Default Color + #XACT: Aria information for the ColorPicker Alpha slider COLORPICKER_ALPHA_SLIDER=Alpha control