{
// Build full key with namespace prefix if provided
const fullKey = options?.ns ? `${options.ns}.${key}` : key
@@ -22,8 +22,8 @@ const mockTranslation = vi.fn((key: string, options?: { ns?: string }) => {
return translations[fullKey] || key
})
-vi.mock('../hooks', () => ({
- useMixedTranslation: (_locale?: string) => ({
+vi.mock('#i18n', () => ({
+ useTranslation: () => ({
t: mockTranslation,
}),
}))
@@ -145,36 +145,6 @@ describe('SortDropdown', () => {
})
})
- // ================================
- // Props Testing
- // ================================
- describe('Props', () => {
- it('should accept locale prop', () => {
- render(
)
-
- expect(screen.getByTestId('portal-wrapper')).toBeInTheDocument()
- })
-
- it('should call useMixedTranslation with provided locale', () => {
- render(
)
-
- // Translation function should be called for labels
- expect(mockTranslation).toHaveBeenCalledWith('marketplace.sortBy', { ns: 'plugin' })
- })
-
- it('should render without locale prop (undefined)', () => {
- render(
)
-
- expect(screen.getByText('Sort by')).toBeInTheDocument()
- })
-
- it('should render with empty string locale', () => {
- render(
)
-
- expect(screen.getByText('Sort by')).toBeInTheDocument()
- })
- })
-
// ================================
// State Management Tests
// ================================
@@ -618,13 +588,6 @@ describe('SortDropdown', () => {
expect(mockTranslation).toHaveBeenCalledWith('marketplace.sortOption.newlyReleased', { ns: 'plugin' })
expect(mockTranslation).toHaveBeenCalledWith('marketplace.sortOption.firstReleased', { ns: 'plugin' })
})
-
- it('should pass locale to useMixedTranslation', () => {
- render(
)
-
- // Verify component renders with locale
- expect(screen.getByTestId('portal-wrapper')).toBeInTheDocument()
- })
})
// ================================
diff --git a/web/app/components/plugins/marketplace/sort-dropdown/index.tsx b/web/app/components/plugins/marketplace/sort-dropdown/index.tsx
index a1f6631735..984b114d03 100644
--- a/web/app/components/plugins/marketplace/sort-dropdown/index.tsx
+++ b/web/app/components/plugins/marketplace/sort-dropdown/index.tsx
@@ -1,4 +1,5 @@
'use client'
+import { useTranslation } from '#i18n'
import {
RiArrowDownSLine,
RiCheckLine,
@@ -9,16 +10,10 @@ import {
PortalToFollowElemContent,
PortalToFollowElemTrigger,
} from '@/app/components/base/portal-to-follow-elem'
-import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
import { useMarketplaceContext } from '../context'
-type SortDropdownProps = {
- locale?: string
-}
-const SortDropdown = ({
- locale,
-}: SortDropdownProps) => {
- const { t } = useMixedTranslation(locale)
+const SortDropdown = () => {
+ const { t } = useTranslation()
const options = [
{
value: 'install_count',
diff --git a/web/app/components/plugins/marketplace/sticky-search-and-switch-wrapper.tsx b/web/app/components/plugins/marketplace/sticky-search-and-switch-wrapper.tsx
index 602a1e9af2..3d3530c83e 100644
--- a/web/app/components/plugins/marketplace/sticky-search-and-switch-wrapper.tsx
+++ b/web/app/components/plugins/marketplace/sticky-search-and-switch-wrapper.tsx
@@ -5,13 +5,11 @@ import PluginTypeSwitch from './plugin-type-switch'
import SearchBoxWrapper from './search-box/search-box-wrapper'
type StickySearchAndSwitchWrapperProps = {
- locale?: string
pluginTypeSwitchClassName?: string
showSearchParams?: boolean
}
const StickySearchAndSwitchWrapper = ({
- locale,
pluginTypeSwitchClassName,
showSearchParams,
}: StickySearchAndSwitchWrapperProps) => {
@@ -25,9 +23,8 @@ const StickySearchAndSwitchWrapper = ({
pluginTypeSwitchClassName,
)}
>
-
+
diff --git a/web/app/components/plugins/plugin-item/index.tsx b/web/app/components/plugins/plugin-item/index.tsx
index d287bd9e9a..3f658c63a8 100644
--- a/web/app/components/plugins/plugin-item/index.tsx
+++ b/web/app/components/plugins/plugin-item/index.tsx
@@ -44,7 +44,7 @@ const PluginItem: FC