mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
fix(list-box): correct button/description translations based on selection count (#2139)
The `ListBoxSelection` component now properly handles translations for the clear button based on the selected items: - Fix `buttonLabel` and `description` to use the same translation logic - Add tests for custom translations in both `ComboBox` and `MultiSelect`
This commit is contained in:
parent
9b61af0306
commit
1a5f2d8e67
4 changed files with 75 additions and 13 deletions
|
@ -44,13 +44,12 @@
|
|||
$: if (ctx && ref) {
|
||||
ctx.declareRef({ key: "selection", ref });
|
||||
}
|
||||
|
||||
$: translationId = selectionCount
|
||||
? translationIds.clearAll
|
||||
: translationIds.clearSelection;
|
||||
$: translationId =
|
||||
selectionCount === undefined
|
||||
? translationIds.clearSelection
|
||||
: translationIds.clearAll;
|
||||
$: buttonLabel =
|
||||
translateWithId?.(translationIds.clearAll) ??
|
||||
defaultTranslations[translationIds.clearAll];
|
||||
translateWithId?.(translationId) ?? defaultTranslations[translationId];
|
||||
$: description =
|
||||
translateWithId?.(translationId) ?? defaultTranslations[translationId];
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue