Skip to content

Commit ef3edec

Browse files
committed
feat: localize sort button aria text
1 parent 44c3c03 commit ef3edec

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

packages/components/AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@ Use the `condition && <Element />` pattern to render JSX elements only when a co
3535
```
3636

3737
Avoid using `hidden={condition}` unless the element should always be present in the DOM but visually hidden.
38+
39+
### Language texts
40+
41+
All UI texts must be stored in `src/locales/en.ts` and `src/locales/de.ts`.
42+
New translations get the prefix `kol-` and are referenced in the code using the
43+
`translate()` helper, e.g. `translate('kol-example')`.

packages/components/src/components/table-stateless/component.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -634,23 +634,20 @@ export class KolTableStateless implements TableStatelessAPI {
634634
private renderHeadingCell(cell: KoliBriTableHeaderCell, rowIndex: number, colIndex: number, isVertical: boolean): JSX.Element {
635635
let ariaSort: AriaSort = 'none';
636636
let sortButtonIcon = 'codicon codicon-fold';
637-
let ariaDescription = 'aufsteigend sortieren';
637+
const ariaDescription = translate('kol-sort');
638638

639639
if (cell.sortDirection) {
640640
switch (cell.sortDirection) {
641641
case 'ASC':
642642
sortButtonIcon = 'codicon codicon-chevron-up';
643643
ariaSort = 'ascending';
644-
ariaDescription = 'aufsteigend sortiert';
645644
break;
646645
case 'DESC':
647646
sortButtonIcon = 'codicon codicon-chevron-down';
648647
ariaSort = 'descending';
649-
ariaDescription = 'absteigend sortiert';
650648
break;
651649
default:
652650
ariaSort = 'none';
653-
ariaDescription = 'aufsteigend sortieren';
654651
}
655652
}
656653

packages/components/src/components/table-stateless/readme.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,8 @@ const selection: KoliBriTableSelection = {
7272
/>
7373
```
7474

75-
Der Sortierschalter verwendet nun das Attribut `_aria-description` und setzt je nach
76-
`aria-sort` die folgenden Texte:
77-
78-
- `none` → "aufsteigend sortieren"
79-
- `ascending` → "aufsteigend sortiert"
80-
- `descending` → "absteigend sortiert"
75+
Der Sortierschalter verwendet das Attribut `_aria-description` und zeigt immer den
76+
Sprachtext `kol-sort` an, unabhängig vom aktuellen Sortierzustand.
8177

8278
<!-- Auto Generated Below -->
8379

packages/components/src/locales/de.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export default {
4848
'hide-password': 'ausblenden',
4949
'no-results-message': 'Keine Ergebnisse gefunden.',
5050
'delete-selection': 'Auswahl entfernen',
51+
sort: 'sortieren',
5152
'pagination-position-top': 'oben',
5253
'pagination-position-bottom': 'unten',
5354
};

packages/components/src/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export default {
4848
'hide-password': 'Hide',
4949
'no-results-message': 'No results found.',
5050
'delete-selection': 'Delete selection',
51+
sort: 'Sort',
5152
'pagination-position-top': 'top',
5253
'pagination-position-bottom': 'bottom',
5354
};

0 commit comments

Comments
 (0)