File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed
packages/react-sdk-components/src/components
SimpleTable/SimpleTableManual Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 1- /* eslint-disable import/prefer-default-export */
21export function isEmptyObject ( obj : Object ) : boolean {
32 return Object . keys ( obj ) . length === 0 ;
43}
4+
5+ /**
6+ * Get a localized value from the Generic Fields
7+ * @param path - The path within Generic Fields (e.g., 'CosmosFields.fields.lists')
8+ * @param key - The key of the string to localize
9+ * @returns The localized string or the key itself if no translation is found
10+ */
11+ export function getGenericFieldsLocalizedValue ( path : string , key : string ) : string {
12+ const GENERIC_BUNDLE_KEY = PCore . getLocaleUtils ( ) . GENERIC_BUNDLE_KEY ;
13+ const localeStore = PCore . getLocaleUtils ( ) . localeStore [ GENERIC_BUNDLE_KEY ] ;
14+
15+ if ( ! localeStore ) return key ;
16+
17+ // Split the path and traverse the object
18+ const pathParts = path . split ( '.' ) ;
19+ let currentObj = localeStore ;
20+
21+ for ( const part of pathParts ) {
22+ if ( ! currentObj [ part ] ) return key ;
23+ currentObj = currentObj [ part ] ;
24+ }
25+
26+ return currentObj [ key ] || key ;
27+ }
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ import { filterData } from '../../helpers/simpleTableHelpers';
4343import './ListView.css' ;
4444import { getDateFormatInfo } from '../../helpers/date-format-utils' ;
4545import { getCurrencyOptions } from '../../field/Currency/currency-utils' ;
46+ import { getGenericFieldsLocalizedValue } from '../../helpers/common-utils' ;
4647import { format } from '../../helpers/formatters' ;
4748
4849import useInit from './hooks' ;
@@ -1129,7 +1130,9 @@ export default function ListView(props: ListViewProps) {
11291130 } ) }
11301131 </ TableBody >
11311132 </ Table >
1132- { arRows && arRows . length === 0 && < div className = 'no-records' > No records found.</ div > }
1133+ { arRows && arRows . length === 0 && (
1134+ < div className = 'no-records' > { getGenericFieldsLocalizedValue ( 'CosmosFields.fields.lists' , 'No records found.' ) } </ div >
1135+ ) }
11331136 </ TableContainer >
11341137 ) }
11351138 </ >
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import createPConnectComponent from '../../../../bridge/react_pconnect';
2727import { Utils } from '../../../helpers/utils' ;
2828import { getReferenceList } from '../../../helpers/field-group-utils' ;
2929import { getDataPage } from '../../../helpers/data_page' ;
30+ import { getGenericFieldsLocalizedValue } from '../../../helpers/common-utils' ;
3031import { buildFieldsForTable , filterData , getContext } from '../../../helpers/simpleTableHelpers' ;
3132import { PConnProps } from '../../../../types/PConnProps' ;
3233import { format } from '../../../helpers/formatters' ;
@@ -711,7 +712,7 @@ export default function SimpleTableManual(props: PropsWithChildren<SimpleTableMa
711712 </ Table >
712713 { ( ( readOnlyMode && ( ! rowData || rowData ?. length === 0 ) ) || ( editableMode && ( ! referenceList || referenceList ?. length === 0 ) ) ) && (
713714 < div className = 'no-records' id = 'no-records' >
714- No records found.
715+ { getGenericFieldsLocalizedValue ( 'CosmosFields.fields.lists' , ' No records found.' ) }
715716 </ div >
716717 ) }
717718 </ TableContainer >
You can’t perform that action at this time.
0 commit comments