feat(i18n): 增强生理周期模块的国际化支持,添加多语言格式和翻译

This commit is contained in:
richarjiang
2025-12-18 09:36:08 +08:00
parent 4836058d56
commit feb5052fcd
11 changed files with 192 additions and 52 deletions

View File

@@ -1,19 +1,21 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { StyleSheet, Text, View } from 'react-native';
import { STATUS_COLORS } from './constants';
import { LegendItem } from './types';
const LEGEND_ITEMS: LegendItem[] = [
{ label: '经期', key: 'period' },
{ label: '预测经期', key: 'predicted-period' },
{ label: '排卵期', key: 'fertile' },
{ label: '排卵日', key: 'ovulation-day' },
];
export const Legend: React.FC = () => {
const { t } = useTranslation();
const legendItems: LegendItem[] = [
{ label: t('menstrual.legend.period'), key: 'period' },
{ label: t('menstrual.legend.predictedPeriod'), key: 'predicted-period' },
{ label: t('menstrual.legend.fertile'), key: 'fertile' },
{ label: t('menstrual.legend.ovulation'), key: 'ovulation-day' },
];
return (
<View style={styles.legendRow}>
{LEGEND_ITEMS.map((item) => (
{legendItems.map((item) => (
<View key={item.key} style={styles.legendItem}>
<View
style={[