Add Chinese translations for medication management and personal settings

- Introduced new translation files for medication, personal, and weight management in Chinese.
- Updated the main index file to include the new translation modules.
- Enhanced the medication type definitions to include 'ointment'.
- Refactored workout type labels to utilize i18n for better localization support.
- Improved sleep quality descriptions and recommendations with i18n integration.
This commit is contained in:
richarjiang
2025-11-28 17:29:51 +08:00
parent fbe0c92f0f
commit bca6670390
42 changed files with 7972 additions and 6632 deletions

View File

@@ -1,3 +1,4 @@
import { useI18n } from '@/hooks/useI18n';
import dayjs from 'dayjs';
import HealthKitManager, { HealthKitUtils } from './healthKit';
@@ -340,25 +341,27 @@ export const calculateSleepScore = (
* 获取睡眠质量描述和建议
*/
export const getSleepQualityInfo = (sleepScore: number): { description: string; recommendation: string } => {
const { t } = useI18n();
if (sleepScore >= 85) {
return {
description: '你身心愉悦并且精力充沛',
recommendation: '恭喜你获得优质的睡眠!如果你感到精力充沛,可以考虑中等强度的运动,以维持健康的生活方式,并进一步减轻压力,以获得最佳睡眠。'
description: t('sleepQuality.excellent.description'),
recommendation: t('sleepQuality.excellent.recommendation')
};
} else if (sleepScore >= 70) {
return {
description: '睡眠质量良好,精神状态不错',
recommendation: '你的睡眠质量还不错,但还有改善空间。建议保持规律的睡眠时间,睡前避免使用电子设备,营造安静舒适的睡眠环境。'
description: t('sleepQuality.good.description'),
recommendation: t('sleepQuality.good.recommendation')
};
} else if (sleepScore >= 50) {
return {
description: '睡眠质量一般,可能影响日间表现',
recommendation: '你的睡眠需要改善。建议制定固定的睡前例行程序,限制咖啡因摄入,确保卧室温度适宜,考虑进行轻度运动来改善睡眠质量。'
description: t('sleepQuality.fair.description'),
recommendation: t('sleepQuality.fair.recommendation')
};
} else {
return {
description: '睡眠质量较差,建议重视睡眠健康',
recommendation: '你的睡眠质量需要严重关注。建议咨询医生或睡眠专家,检查是否有睡眠障碍,同时改善睡眠环境和习惯,避免睡前刺激性活动。'
description: t('sleepQuality.poor.description'),
recommendation: t('sleepQuality.poor.recommendation')
};
}
};