Skip to content

Commit

Permalink
fix(ui5-color-palette): add i18n text for default color button's text (
Browse files Browse the repository at this point in the history
…#8157)

Currently in our `<ui5-color-palette>` and `<ui5-color-palette-popover>` 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.
  • Loading branch information
hinzzx committed Jan 22, 2024
1 parent 3c039a0 commit 7b4dac3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/main/src/ColorPalette.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class="ui5-cp-default-color-button"
design="Transparent"
@click={{_onDefaultColorClick}}
@keydown={{_onDefaultColorKeyDown}}>Default color</ui5-button>
@keydown={{_onDefaultColorKeyDown}}>{{colorPaletteDefaultColorText}}</ui5-button>
<div class="ui5-cp-separator"></div>
</div>
{{/if}}
Expand All @@ -35,7 +35,7 @@
class="ui5-cp-more-colors"
@click="{{_openMoreColorsDialog}}"
@keydown={{_onMoreColorsKeyDown}}
>{{colorPaleteMoreColorsText}}</ui5-button>
>{{colorPaletteMoreColorsText}}</ui5-button>
</div>
{{/if}}

Expand Down
7 changes: 6 additions & 1 deletion packages/main/src/ColorPalette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
5 changes: 4 additions & 1 deletion packages/main/src/i18n/messagebundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7b4dac3

Please sign in to comment.