translate rate
This commit is contained in:
@@ -50,6 +50,11 @@ function RatingOrderIndex({ }: Props) {
|
||||
NegativePointEnum.UNFRIENDLY_SERVICE,
|
||||
];
|
||||
|
||||
const getTranslationKey = (point: string, isPositive: boolean): string => {
|
||||
const basePath = isPositive ? 'Tabs.Strengths.Options' : 'Tabs.Weeknesses.Options';
|
||||
return `${basePath}.${point}`;
|
||||
};
|
||||
|
||||
const handleToggle = (pointValue: string, isPositive: boolean) => (checked: boolean) => {
|
||||
const setter = isPositive ? setPositivePoints : setNegativePoints;
|
||||
|
||||
@@ -76,7 +81,7 @@ function RatingOrderIndex({ }: Props) {
|
||||
// @ts-expect-error - Type mismatch between custom ToggleButton and React types
|
||||
onToggle={handleToggle(point, false)}
|
||||
>
|
||||
{t(`Tabs.Weeknesses.Options.${point}`)}
|
||||
{t(getTranslationKey(point, false))}
|
||||
</ToggleButton>
|
||||
))}
|
||||
</div>
|
||||
@@ -95,7 +100,7 @@ function RatingOrderIndex({ }: Props) {
|
||||
// @ts-expect-error - Type mismatch between custom ToggleButton and React types
|
||||
onToggle={handleToggle(point, true)}
|
||||
>
|
||||
{t(`Tabs.Strengths.Options.${point}`)}
|
||||
{t(getTranslationKey(point, true))}
|
||||
</ToggleButton>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const enum PositivePointEnum {
|
||||
export enum PositivePointEnum {
|
||||
GREAT_TASTE = "great_taste",
|
||||
FAST_DELIVERY = "fast_delivery",
|
||||
GOOD_QUALITY = "good_quality",
|
||||
@@ -6,7 +6,7 @@ export const enum PositivePointEnum {
|
||||
FRIENDLY_SERVICE = "friendly_service",
|
||||
}
|
||||
|
||||
export const enum NegativePointEnum {
|
||||
export enum NegativePointEnum {
|
||||
SMALL_PORTION = "small_portion",
|
||||
SLOW_DELIVERY = "slow_delivery",
|
||||
POOR_QUALITY = "poor_quality",
|
||||
|
||||
Reference in New Issue
Block a user