mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-21 21:36:42 +08:00
### What problem does this PR solve? Fix(i18n): Added new translations #3221 - Added and updated internationalization translations in multiple components ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { variableEnabledFieldMap } from '@/constants/chat';
|
||||
import { TFunction } from 'i18next';
|
||||
import omit from 'lodash/omit';
|
||||
|
||||
// chat model setting and generate operator
|
||||
@ -27,7 +28,17 @@ export const removeUselessFieldsFromValues = (values: any, prefix?: string) => {
|
||||
return nextValues;
|
||||
};
|
||||
|
||||
export function buildOptions(data: Record<string, any>) {
|
||||
export function buildOptions(
|
||||
data: Record<string, any>,
|
||||
t?: TFunction<['translation', ...string[]], undefined>,
|
||||
prefix?: string,
|
||||
) {
|
||||
if (t) {
|
||||
return Object.values(data).map((val) => ({
|
||||
label: t(`${prefix ? prefix + '.' : ''}${val.toLowerCase()}`),
|
||||
value: val,
|
||||
}));
|
||||
}
|
||||
return Object.values(data).map((val) => ({ label: val, value: val }));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user