Files
stc32g128k/App/language.h
edisondeng a7a2cc9465 暂存
2026-07-31 13:57:06 +08:00

42 lines
1.3 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __LANGUAGE_H__
#define __LANGUAGE_H__
#include "config.h"
#include "strings.h"
/* ====== 界面语言选择 ====== */
typedef enum {
LANG_FR = 0, // 法语 (默认)
LANG_EN, // 英语
LANG_COUNT
} Language;
/**
* @brief 语言模块初始化 (开机时由 Load_Database 读取 Flash 中保存的语言字节后调用)
* @param lang 要设为当前语言的枚举值。若超出 LANG_COUNT 范围 (如 Flash 未写过时的 0xFF),回退为 LANG_FR。
*/
void Lang_Init(Language lang);
/**
* @brief 切换当前界面语言 (不负责持久化,调用方需自行决定是否写入 Flash)
* @param lang 目标语言
*/
void Lang_Set(Language lang);
/**
* @brief 查询当前界面语言
* @return Language 当前语言枚举值
*/
Language Lang_Current(void);
/**
* @brief 取指定字符串 ID 在当前语言下的文本
* @param id 字符串 ID (见 strings.h 中 WRISTBAND_STRING_LIST 登记表)
* @return char* 当前语言对应的文案指针id 越界时返回空字符串
* @note 返回类型不加 const是为了直接兼容 LCD_ShowString 系列接口的 char* 参数,
* 与本项目其余字符串接口 (Uart_SendString 等) 的风格保持一致。
*/
char *Lang_Get(StringID id);
#endif // __LANGUAGE_H__