mirror of
https://github.com/langgenius/dify.git
synced 2026-04-25 09:36:40 +08:00
Co-authored-by: AkaraChen <akarachen@outlook.com> Co-authored-by: Yi <yxiaoisme@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: kurokobo <kuro664@gmail.com> Co-authored-by: Hiroshi Fujita <fujita-h@users.noreply.github.com>
15 lines
464 B
TypeScript
15 lines
464 B
TypeScript
import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'
|
|
|
|
export const renderI18nObject = (obj: Record<string, string>, language: string) => {
|
|
if (obj?.[language]) return obj[language]
|
|
if (obj?.en_US) return obj.en_US
|
|
return Object.values(obj)[0]
|
|
}
|
|
|
|
export const useRenderI18nObject = () => {
|
|
const language = useLanguage()
|
|
return (obj: Record<string, string>) => {
|
|
return renderI18nObject(obj, language)
|
|
}
|
|
}
|