feat(i18n): Enhance internationalization support and error handling messages

- Added i18n keys for various error and info messages related to task management, user handling, and storage operations.
- Updated error messages in the watch and task handling commands to use i18n for better localization.
- Refactored error handling in the database initialization and user synchronization processes to provide clearer messages.
- Improved logging messages for better clarity and consistency across the application.
- Added comprehensive documentation for AI collaboration and project structure in the repository.
This commit is contained in:
krau
2025-12-19 16:01:36 +08:00
parent bc892d9370
commit 9ed2c425be
21 changed files with 564 additions and 142 deletions

View File

@@ -18,7 +18,7 @@ func handleDirCmd(ctx *ext.Context, update *ext.Update) error {
userChatID := update.GetUserChat().GetID()
dirs, err := database.GetUserDirsByChatID(ctx, userChatID)
if err != nil {
logger.Errorf("获取用户文件夹失败: %s", err)
logger.Errorf("Failed to get user directories: %s", err)
ctx.Reply(update, ext.ReplyTextString("获取用户文件夹失败"), nil)
return dispatcher.EndGroups
}
@@ -28,7 +28,7 @@ func handleDirCmd(ctx *ext.Context, update *ext.Update) error {
}
user, err := database.GetUserByChatID(ctx, update.GetUserChat().GetID())
if err != nil {
logger.Errorf("获取用户失败: %s", err)
logger.Errorf("Failed to get user: %s", err)
ctx.Reply(update, ext.ReplyTextString("获取用户失败"), nil)
return dispatcher.EndGroups
}
@@ -45,7 +45,7 @@ func handleDirCmd(ctx *ext.Context, update *ext.Update) error {
}
if err := database.CreateDirForUser(ctx, user.ID, args[2], args[3]); err != nil {
logger.Errorf("创建文件夹失败: %s", err)
logger.Errorf("Failed to create directory: %s", err)
ctx.Reply(update, ext.ReplyTextString("创建文件夹失败"), nil)
return dispatcher.EndGroups
}
@@ -62,7 +62,7 @@ func handleDirCmd(ctx *ext.Context, update *ext.Update) error {
return dispatcher.EndGroups
}
if err := database.DeleteDirByID(ctx, uint(dirID)); err != nil {
logger.Errorf("删除文件夹失败: %s", err)
logger.Errorf("Failed to delete directory: %s", err)
ctx.Reply(update, ext.ReplyTextString("删除文件夹失败"), nil)
return dispatcher.EndGroups
}