i18n.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. from __future__ import annotations
  2. from typing import Any
  3. TELEGRAM_PERMISSION_LABELS = {
  4. "can_manage_chat": "管理群组",
  5. "can_delete_messages": "删除消息",
  6. "can_manage_video_chats": "管理视频聊天",
  7. "can_restrict_members": "限制成员",
  8. "can_promote_members": "任命管理员",
  9. "can_change_info": "修改群信息",
  10. "can_post_messages": "发布消息",
  11. "can_edit_messages": "编辑消息",
  12. "can_invite_users": "邀请成员",
  13. "can_pin_messages": "置顶消息",
  14. "can_send_messages": "发送文字",
  15. "can_send_media_messages": "发送媒体",
  16. "can_send_other_messages": "发送贴纸及其他内容",
  17. "can_send_polls": "发送投票",
  18. "can_add_web_page_previews": "显示网页预览",
  19. }
  20. MEMBER_ACTION_LABELS = {
  21. "warn": "警告",
  22. "ban": "封禁",
  23. "unban": "解除封禁",
  24. "kick": "踢出",
  25. "mute": "禁言",
  26. "unmute": "解除禁言",
  27. "promote": "提升为管理员",
  28. "demote": "取消管理员",
  29. }
  30. POINT_SOURCE_LABELS = {
  31. "checkin": "每日签到",
  32. "activity": "活跃奖励",
  33. "upvote": "点赞奖励",
  34. "admin_adjustment": "管理员调整",
  35. "giveaway_entry": "抽奖报名",
  36. "giveaway_refund": "抽奖退款",
  37. "giveaway_participation": "抽奖参与奖励",
  38. "giveaway_winner": "抽奖中奖奖励",
  39. }
  40. GIVEAWAY_STATUS_LABELS = {
  41. "running": "进行中",
  42. "drawing": "开奖中",
  43. "canceling": "退款中",
  44. "finished": "已开奖",
  45. "canceled": "已取消",
  46. }
  47. def telegram_permission_label(value: Any) -> str:
  48. key = str(value)
  49. return TELEGRAM_PERMISSION_LABELS.get(key, key)
  50. def member_action_label(value: Any) -> str:
  51. key = str(value)
  52. return MEMBER_ACTION_LABELS.get(key, key)
  53. def point_source_label(value: Any) -> str:
  54. key = str(value)
  55. return POINT_SOURCE_LABELS.get(key, key)
  56. def giveaway_status_label(value: Any) -> str:
  57. key = str(value)
  58. return GIVEAWAY_STATUS_LABELS.get(key, key)