feat: Enhance Oxygen Saturation Card with health permissions and loading state management

feat(i18n): Add common translations and mood-related strings in English and Chinese

fix(i18n): Update metabolism titles for consistency in health translations

chore: Update Podfile.lock to include SDWebImage 5.21.4 and other dependency versions

refactor(moodCheckins): Improve mood configuration retrieval with optional translation support

refactor(sleepHealthKit): Replace useI18n with direct i18n import for sleep quality descriptions
This commit is contained in:
2025-11-28 23:48:38 +08:00
parent bca6670390
commit 83b77615cf
19 changed files with 512 additions and 254 deletions

View File

@@ -146,14 +146,26 @@ export type MoodOption = {
};
// 获取心情配置
export function getMoodConfig(moodType: MoodType) {
return MOOD_CONFIG[moodType];
export function getMoodConfig(moodType: MoodType, t?: (key: string) => string) {
const config = MOOD_CONFIG[moodType];
// When translation function is provided, prefer localized labels.
if (t) {
return {
...config,
label: t(`mood.types.${moodType}`),
};
}
return config;
}
// 获取所有心情选项
export function getMoodOptions(): MoodOption[] {
export function getMoodOptions(t?: (key: string) => string): MoodOption[] {
return Object.entries(MOOD_CONFIG).map(([type, config]) => ({
type: type as MoodType,
...config,
// 如果提供了翻译函数,则使用翻译后的标签,否则使用默认的中文标签
label: t ? t(`mood.types.${type}`) : config.label,
}));
}