Add i18n localization to sort-type-box component
- Replace hardcoded Korean sort labels with translation keys - Add useTranslation hook to sort-type-box.tsx - Add common.highAmountOrder to ko.json and en.json - Use filter.sortOrders.latest for latest sort option - Convert default sortOptions to use t() function Now supports dynamic language switching for sort options. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
import { SortTypeKeys, SortTypeBoxProps } from '../model/types';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export const SortTypeBox = ({
|
||||
sortType,
|
||||
onClickToSort,
|
||||
sortOptions = [
|
||||
{ key: SortTypeKeys.LATEST, label: '최신순' },
|
||||
{ key: SortTypeKeys.HIGH_AMOUNT, label: '고액순' }
|
||||
]
|
||||
sortOptions
|
||||
}: SortTypeBoxProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const defaultSortOptions = [
|
||||
{ key: SortTypeKeys.LATEST, label: t('filter.sortOrders.latest') },
|
||||
{ key: SortTypeKeys.HIGH_AMOUNT, label: t('common.highAmountOrder') }
|
||||
];
|
||||
|
||||
const options = sortOptions || defaultSortOptions;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="sort-options">
|
||||
{ sortOptions.map((option: Record<string, any>, index: number) => (
|
||||
{ options.map((option: Record<string, any>, index: number) => (
|
||||
<>
|
||||
{ (index > 0) &&
|
||||
<span className="sort-divider">|</span>
|
||||
|
||||
Reference in New Issue
Block a user