File tree Expand file tree Collapse file tree 4 files changed +17
-0
lines changed
components/table-stateless Expand file tree Collapse file tree 4 files changed +17
-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 @@ -71,6 +71,8 @@ export class KolTableStateless implements TableStatelessAPI {
7171
7272 private checkboxRefs : HTMLInputElement [ ] = [ ] ;
7373
74+ private translateSort = translate ( 'kol-sort' ) ;
75+
7476 @State ( )
7577 private tableDivElementHasScrollbar = false ;
7678
@@ -840,6 +842,7 @@ export class KolTableStateless implements TableStatelessAPI {
840842 exportparts = "icon"
841843 _icons = { { right : sortButtonIcon } }
842844 _label = { cell . label }
845+ _ariaDescription = { this . translateSort }
843846 _on = { {
844847 onClick : ( event : MouseEvent ) => {
845848 if ( typeof this . state . _on ?. onSort === 'function' && cell . key && cell . sortDirection ) {
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ export default {
5858 'delete-selection' : 'Auswahl entfernen' ,
5959 'filename-text' : 'Datei auswählen oder hier ablegen...' ,
6060 'data-browse-text' : 'Datei auswählen' ,
61+ sort : 'sortieren' ,
6162 'pagination-position-top' : 'oben' ,
6263 'pagination-position-bottom' : 'unten' ,
6364} ;
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ export default {
5858 'delete-selection' : 'Delete selection' ,
5959 'filename-text' : 'Choose a file or drop it here...' ,
6060 'data-browse-text' : 'Browse' ,
61+ sort : 'Sort' ,
6162 'pagination-position-top' : 'top' ,
6263 'pagination-position-bottom' : 'bottom' ,
6364} ;
You can’t perform that action at this time.
0 commit comments