diff --git a/web/app/components/explore/app-list/index.tsx b/web/app/components/explore/app-list/index.tsx index e15a572e46..738e1c7c56 100644 --- a/web/app/components/explore/app-list/index.tsx +++ b/web/app/components/explore/app-list/index.tsx @@ -1,11 +1,11 @@ 'use client' import React, { FC, useEffect } from 'react' +import { useTranslation } from 'react-i18next' import Category from '@/app/components/explore/category' import AppCard from '@/app/components/explore/app-card' import { fetchAppList } from '@/service/explore' - const mockList = [ { id: 1, @@ -28,6 +28,8 @@ const mockCategories = ['music', 'news'] const isMock = true const Apps: FC = ({ }) => { + const { t } = useTranslation() + const [currCategory, setCurrCategory] = React.useState('') const [allList, setAllList] = React.useState(isMock ? mockList : []) const currList = (() => { @@ -47,8 +49,8 @@ const Apps: FC = ({ }) => { return (
-
Explore Apps by Dify
-
Use these template apps instantly or customize your own apps based on the templates.
+
{t('explore.apps.title')}
+
{t('explore.apps.description')}
= ({ value, onChange }) => { - const itemClassName = (isSelected: boolean) => cn(isSelected ? 'bg-white text-primary-600 border-gray-200 font-semibold' : 'border-transparent font-medium','flex items-center h-7 px-3 border cursor-pointer rounded') + const { t } = useTranslation() + + const itemClassName = (isSelected: boolean) => cn(isSelected ? 'bg-white text-primary-600 border-gray-200 font-semibold' : 'border-transparent font-medium','flex items-center h-7 px-3 border cursor-pointer rounded-lg') const itemStyle = (isSelected: boolean) => isSelected ? {boxShadow: '0px 1px 2px rgba(16, 24, 40, 0.05)'} : {} return (
@@ -24,7 +27,7 @@ const Category: FC = ({ style={itemStyle('' === value)} onClick={() => onChange('')} > - All Categories + {t('explore.apps.allCategories')}
{list.map(name => (
( ) const SideBar: FC = () => { + const { t } = useTranslation() + return (
@@ -28,12 +31,12 @@ const SideBar: FC = () => { style={{boxShadow: '0px 1px 2px rgba(16, 24, 40, 0.05)'}} > -
Discovery
+
{t('explore.sidebar.discovery')}
-
Workspace
-
+
{t('explore.sidebar.workspace')}
+
{list.map(({id, name}) => { return ( diff --git a/web/i18n/i18next-config.ts b/web/i18n/i18next-config.ts index 49d729e7c7..7da90a10c3 100644 --- a/web/i18n/i18next-config.ts +++ b/web/i18n/i18next-config.ts @@ -31,6 +31,8 @@ import datasetSettingsEn from './lang/dataset-settings.en' import datasetSettingsZh from './lang/dataset-settings.zh' import datasetCreationEn from './lang/dataset-creation.en' import datasetCreationZh from './lang/dataset-creation.zh' +import exploreEn from './lang/explore.en' +import exploreZh from './lang/explore.zh' import { getLocaleOnClient } from '@/i18n/client' const resources = { @@ -53,6 +55,7 @@ const resources = { datasetHitTesting: datasetHitTestingEn, datasetSettings: datasetSettingsEn, datasetCreation: datasetCreationEn, + explore: exploreEn, }, }, 'zh-Hans': { @@ -74,6 +77,7 @@ const resources = { datasetHitTesting: datasetHitTestingZh, datasetSettings: datasetSettingsZh, datasetCreation: datasetCreationZh, + explore: exploreZh, }, }, } diff --git a/web/i18n/lang/explore.en.ts b/web/i18n/lang/explore.en.ts new file mode 100644 index 0000000000..7a2ec27335 --- /dev/null +++ b/web/i18n/lang/explore.en.ts @@ -0,0 +1,13 @@ +const translation = { + sidebar: { + discovery: 'Discovery', + workspace: 'Workspace', + }, + apps: { + title: 'Explore Apps by Dify', + description: 'Use these template apps instantly or customize your own apps based on the templates.', + allCategories: 'All Categories', + } +} + +export default translation diff --git a/web/i18n/lang/explore.zh.ts b/web/i18n/lang/explore.zh.ts new file mode 100644 index 0000000000..a3e44b1ce3 --- /dev/null +++ b/web/i18n/lang/explore.zh.ts @@ -0,0 +1,13 @@ +const translation = { + sidebar: { + discovery: '发现', + workspace: '工作区', + }, + apps: { + title: '探索 Dify 的应用', + description: '使用这些模板应用程序,或根据模板自定义您自己的应用程序。', + allCategories: '所有类别', + } +} + +export default translation