File tree Expand file tree Collapse file tree 5 files changed +20
-0
lines changed
components/table-stateless Expand file tree Collapse file tree 5 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -35,3 +35,15 @@ Use the `condition && <Element />` pattern to render JSX elements only when a co
3535```
3636
3737Avoid 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') ` .
44+ Call ` translate() ` once when the component instance is created (e.g. in a field
45+ initializer) and reuse the result. This prevents unnecessary work while still
46+ updating texts when the component is rerendered. Cache the value in a class
47+ property whose name starts with ` translate ` followed by the translation
48+ identifier, for example ` translateSort ` for ` kol-sort ` or ` translateOrderBy `
49+ for ` kol-order-by ` .
Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ export class KolTableStateless implements TableStatelessAPI {
6161
6262 private checkboxRefs : HTMLInputElement [ ] = [ ] ;
6363
64+ private translateSort = translate ( 'kol-sort' ) ;
65+
6466 @State ( )
6567 private tableDivElementHasScrollbar = false ;
6668
@@ -671,6 +673,7 @@ export class KolTableStateless implements TableStatelessAPI {
671673 exportparts = "icon"
672674 _icons = { { right : sortButtonIcon } }
673675 _label = { cell . label }
676+ _ariaDescription = { this . translateSort }
674677 _on = { {
675678 onClick : ( event : MouseEvent ) => {
676679 if ( typeof this . state . _on ?. onSort === 'function' && cell . key && cell . sortDirection ) {
Original file line number Diff line number Diff line change @@ -71,6 +71,9 @@ const selection: KoliBriTableSelection = {
7171/ >
7272```
7373
74+ Der Sortierschalter verwendet das Attribut ` _aria-description ` und zeigt immer den
75+ Sprachtext ` kol-sort ` an, unabhängig vom aktuellen Sortierzustand.
76+
7477<!-- Auto Generated Below -->
7578
7679## Properties
Original file line number Diff line number Diff 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} ;
Original file line number Diff line number Diff 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} ;
You can’t perform that action at this time.
0 commit comments