Skip to content

⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。

feat(editor): 可视化编辑器中英文国际化与配置英文版

sansan1f178da10e66
diff --git a/config/config.en.yaml b/config/config.en.yaml
new file mode 100644
index 0000000000..b89a4d5126
--- /dev/null
+++ b/config/config.en.yaml
@@ -0,0 +1,499 @@
+# ═══════════════════════════════════════════════════════════════
+# TrendRadar Configuration
+# Version: 2.4.0
+# ═══════════════════════════════════════════════════════════════
+
+
+# Visual config editor: https://sansan0.github.io/TrendRadar/
+
+
+# ===============================================================
+# 1. Basic Settings
+# ===============================================================
+app:
+ # Timezone (affects all time displays, schedule evaluation, and data storage)
+ # Common timezones:
+ # - Asia/Shanghai (Beijing time, UTC+8)
+ # - America/New_York (US Eastern, UTC-5/-4)
+ # - Europe/London (London time, UTC+0/+1)
+ # Full list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
+ timezone: "Asia/Shanghai"
+ show_version_update: true # Show version-update prompt (true=show, false=hide)
+
+
+# ===============================================================
+# 1.5 Schedule System — what to do, and when
+#
+# Controlled by the time periods defined in timeline.yaml:
+# - When to push notifications
+# - When to run AI analysis
+# - Which report mode to use
+#
+# Quick start: pick a preset template and just change the preset value
+#
+# always_on → always on, push as soon as there's anything new
+# morning_evening → push all day + an evening daily summary (recommended)
+# office_hours → three-block workday (onboarding → noon → wrap-up), free incremental on weekends
+# night_owl → afternoon brief + late-night full-day summary
+# custom → fully custom, see timeline.yaml
+#
+# For the detailed timeline diagram see config/timeline.yaml
+# ===============================================================
+schedule:
+ enabled: false # Enable the schedule system (true=on, false=off, default off)
+ preset: "morning_evening" # Preset template name (see above)
+
+
+# ===============================================================
+# 2. Data Source - Hot-list platforms
+#
+# Data sourced from the open-source newsnow project: https://github.com/ourongxing/newsnow
+# You may self-host newsnow and point api_url to your own instance.
+#
+# enabled: whether to crawl hot lists (master switch)
+# api_url: hot-list data API URL (optional; leave empty to use the default)
+# sources: platform list
+# - id: unique platform ID (do not change)
+# - name: display name (customizable; changing it does not affect operation)
+# - expected_domain: domain security check (optional, recommended)
+# Enter the main domain (e.g. baidu.com); it auto-matches the domain and all its subdomains.
+# It verifies that links in the returned data are HTTPS and match the domain; on mismatch the
+# platform's data is dropped and a warning is logged.
+# Effectively guards against link hijacking or data tampering.
+# As long as api_url is not your own instance, configuring expected_domain is recommended.
+# ===============================================================
+platforms:
+ enabled: true # Enable hot-list crawling (true=on, false=off)
+ api_url: "" # Hot-list data API URL (leave empty to use the default)
+ # If you self-host newsnow, enter your address, e.g. https://your-domain.com/api/s
+ sources:
+ - id: "toutiao"
+ name: "Toutiao"
+ expected_domain: "toutiao.com"
+ - id: "baidu"
+ name: "Baidu Hot"
+ expected_domain: "baidu.com"
+ - id: "wallstreetcn-hot"
+ name: "WallStreetCN"
+ expected_domain: "wallstreetcn.com"
+ - id: "thepaper"
+ name: "The Paper"
+ expected_domain: "thepaper.cn"
+ - id: "bilibili-hot-search"
+ name: "Bilibili Hot"
+ expected_domain: "bilibili.com"
+ - id: "cls-hot"
+ name: "CLS Hot"
+ expected_domain: "cls.cn"
+ - id: "ifeng"
+ name: "iFeng"
+ expected_domain: "ifeng.com"
+ - id: "tieba"
+ name: "Tieba"
+ expected_domain: "baidu.com"
+ - id: "weibo"
+ name: "Weibo"
+ expected_domain: "weibo.com"
+ - id: "douyin"
+ name: "Douyin"
+ expected_domain: "douyin.com"
+ - id: "zhihu"
+ name: "Zhihu"
+ expected_domain: "zhihu.com"
+
+
+
+# ===============================================================
+# 3. Data Source - RSS feeds
+#
+# Stored separately from hot-list data and shown as a time stream.
+# Each feed: id (unique), name (display), url (subscription URL)
+# enabled: optional, defaults to true
+# max_age_days: optional, overrides global freshness_filter.max_age_days
+# ===============================================================
+rss:
+ enabled: true # Enable RSS crawling (true=on, false=off)
+
+ # Article freshness filter (filters out stale articles to avoid duplicate pushes)
+ # Filtering happens only at push time; all articles are still stored in the database.
+ freshness_filter:
+ enabled: true # Enable freshness filter (true=on, false=off)
+
+ max_age_days: 1 # Max article age (days)
+ # - Positive integer: push only articles within N days
+ # - 0: disable filtering, push all articles
+
+ # A single feed may set max_age_days to override the global setting:
+ # - Not set: use global freshness_filter.max_age_days (default 3 days)
+ # - Positive integer: override the global setting, push only articles within this many days
+ # - 0: disable freshness filtering for this feed, push all articles
+ feeds:
+ - id: "hacker-news"
+ name: "Hacker News"
+ url: "https://hnrss.org/frontpage"
+
+ - id: "ruanyifeng"
+ name: "Ruan Yi Feng's Blog"
+ url: "http://www.ruanyifeng.com/blog/atom.xml"
+ enabled: false # Disabled
+ # max_age_days: 3 # Example: push articles within 3 days (slower-updating blogs)
+
+ - id: "yahoo-finance"
+ name: "Yahoo Finance"
+ url: "https://finance.yahoo.com/news/rssindex"
+
+ # Custom feed example
+ # - id: "custom-feed"
+ # name: "Custom Feed"
+ # url: "https://example.com/feed.xml"
+ # enabled: false
+ # max_age_days: 0 # Example: disable filtering, push all articles
+
+
+# ===============================================================
+# 4. Report Mode
+# ===============================================================
+report:
+ mode: "current" # Report mode (the default once schedule is on; overridden by timeline periods)
+ # daily = daily summary, push all matched news of the day on schedule (may include previously pushed items)
+ # current = current ranking, push currently-ranked matched news on schedule (persistent items reappear each time)
+ # incremental = incremental monitoring, push only new content, zero duplication (no push if nothing new)
+
+ display_mode: "keyword" # Grouping dimension
+ # keyword = group by keyword
+ # platform = group by platform/source
+
+ sort_by_position_first: false # Keyword-mode ordering (only effective when display_mode=keyword)
+ # true = by the definition order in frequency_words.txt
+ # false = by matched hit count (more hits first)
+
+ rank_threshold: 5 # Rank highlight threshold (affects display emphasis, not crawl scope)
+
+ max_news_per_keyword: 0 # Max items shown per keyword/tag (0=unlimited; only trims display)
+
+
+# ===============================================================
+# 4.5 Filter Strategy
+# ===============================================================
+filter:
+ method: "keyword" # Filter method (choose one)
+ # keyword = keyword matching, no AI, no token cost, but fixed rules
+ # word groups are defined in config/frequency_words.txt
+ # ai = AI smart classification, more flexible but costs tokens each run
+ # interests are in config/ai_interests.txt, requires ai_filter below
+
+ priority_sort_enabled: true # AI-mode tag ordering (only effective when method=ai)
+ # true = by the definition order in the interest description
+ # false = by matched hit count (more hits first)
+
+
+# ===============================================================
+# 4.6 AI Smart Filter (only effective when filter.method=ai)
+# ===============================================================
+ai_filter:
+ batch_size: 200 # Titles sent to the AI per batch; auto-batched beyond this
+ batch_interval: 2 # Batch interval (seconds) to avoid API rate limits; 0=no wait
+
+ min_score: 0.7 # Min push-score threshold (0.0~1.0); higher is stricter
+ # Recommend starting at 0.5~0.7; 0=no filtering
+
+ # Interest description file (defaults to config/ai_interests.txt; no need to configure)
+ # Put custom files in config/custom/ai/ and specify the name:
+ # interests_file: "finance.txt" # → loads config/custom/ai/finance.txt
+
+ reclassify_threshold: 0.6 # Full reclassification trigger threshold (0~1)
+ # Lower → favors full reclassification (more accurate, more tokens)
+ # Higher → favors incremental updates (cheaper, may be less fresh)
+
+ # The prompt templates below generally need no changes (not recommended to touch)
+
+ # Classification prompt template
+ prompt_file: "prompt.txt"
+
+ # Tag extraction prompt template (used on first run)
+ extract_prompt_file: "extract_prompt.txt"
+
+ # Tag update prompt template (AI compares old vs new tags when interests change)
+ update_tags_prompt_file: "update_tags_prompt.txt"
+
+
+# ===============================================================
+# 5. Push Content Control
+#
+# Centrally manage which regions appear in the push message and in what order
+# ===============================================================
+display:
+ # Region display order (top to bottom = top to bottom in the push)
+ # To reorder: just cut and paste whole lines
+ # A region shows only when: 1. it is in this list AND 2. its toggle below is true
+ region_order:
+ - new_items # 1️⃣ New-items region
+ - hotlist # 2️⃣ Hot-list region (keyword match / AI smart filter)
+ - rss # 3️⃣ RSS region
+ - standalone # 4️⃣ Standalone region
+ - ai_analysis # 5️⃣ AI analysis region
+
+ # Push region toggles (used together with region_order above)
+ regions:
+ hotlist: true # Hot-list region: keyword match / AI smart filter (true=show, false=hide)
+ new_items: false # New-items region: hot-list new + RSS new (true=show, false=hide)
+ # Note: the 🆕 new-marker in the hotspot-word stats is not affected by this
+
+ rss: true # RSS region (true=show and analyze, false=hide and skip analysis)
+ standalone: false # Standalone region: full hot-list/RSS, not subject to keyword filtering (true=show, false=hide)
+ ai_analysis: true # AI analysis region (true=show, false=hide)
+
+ # Standalone region: show specified platforms/RSS in full, not subject to keyword filtering
+ # Push display is controlled by regions.standalone; AI analysis by ai_analysis.include_standalone
+ standalone:
+ platforms: ["zhihu", "wallstreetcn-hot"] # Hot-list platform IDs (e.g. ["zhihu", "weibo"])
+ rss_feeds: [] # RSS feed IDs (e.g. ["hacker-news"])
+ max_items: 20 # Max items per source (0=unlimited)
+
+
+# ===============================================================
+# 6. Push Notifications
+#
+# ⚠️ Security warning: do not expose webhook URLs!
+# On GitHub deployments, store webhooks as GitHub Secrets, not here.
+#
+# 📌 Multiple accounts: separate with semicolons (;), e.g. "url1;url2;url3"
+# Paired items (e.g. Telegram token and chat_id) must have matching counts
+# ===============================================================
+notification:
+ enabled: true # Enable notifications (true=on, false=off) — master switch
+ # Still the master switch once schedule is on: false=never push, true=controlled by schedule
+
+ # Push channel configuration
+ channels:
+ feishu:
+ webhook_url: "" # Feishu bot webhook URL
+
+ dingtalk:
+ webhook_url: "" # DingTalk bot webhook URL
+
+ wework:
+ webhook_url: "" # WeCom (Enterprise WeChat) bot webhook URL
+ msg_type: "markdown" # Message type: markdown (group bot) | text (personal WeCom app)
+
+ telegram:
+ bot_token: "" # Telegram Bot Token
+ chat_id: "" # Telegram Chat ID
+
+ email:
+ from: "" # Sender email address
+ password: "" # Sender email password or authorization code
+ to: "" # Recipient email(s); separate multiple addresses with commas
+ smtp_server: "" # SMTP server (optional; auto-detected if empty)
+ smtp_port: "" # SMTP port (optional; auto-detected if empty)
+
+ ntfy:
+ server_url: "https://ntfy.sh" # ntfy server address (can be self-hosted)
+ topic: "" # ntfy topic name
+ token: "" # ntfy access token (optional, for private topics)
+
+ bark:
+ url: "" # Bark push URL (format: https://api.day.app/your_device_key)
+
+ slack:
+ webhook_url: "" # Slack Incoming Webhook URL
+
+ generic_webhook:
+ webhook_url: "" # Generic Webhook URL (supports Discord, Matrix, IFTTT, etc.)
+ payload_template: "" # JSON template, supports {title} and {content} placeholders
+ # Example: {"content": "{content}"}
+ # Leave empty to use the default: {"title": "{title}", "content": "{content}"}
+
+
+# ===============================================================
+# 7. Storage
+# ===============================================================
+storage:
+ # Storage backend selection
+ # - auto: auto-select (uses remote when running in GitHub Actions with remote storage, otherwise local)
+ # - local: local SQLite + TXT/HTML files
+ # - remote: remote cloud storage (S3-compatible, supports R2/OSS/COS, etc.)
+ backend: "auto"
+
+ # Data format options
+ formats:
+ sqlite: true # Primary storage (must stay true; do not disable)
+ txt: false # Generate TXT snapshots (true=generate, false=skip)
+ html: true # Generate HTML reports (true=generate, false=skip)
+ # ⚠️ Must be true for email pushes or to view the web report
+
+ # Local storage configuration
+ local:
+ data_dir: "output" # Data directory
+ retention_days: 0 # Retention days (0=keep forever)
+
+ # Remote storage configuration (S3-compatible)
+ # Supports: Cloudflare R2, Alibaba Cloud OSS, Tencent Cloud COS, AWS S3, MinIO, etc.
+ # Recommended to put sensitive info in GitHub Secrets or environment variables
+ remote:
+ retention_days: 0 # Retention days (0=keep forever)
+
+ # S3-compatible config (or use env vars S3_ENDPOINT_URL, etc.)
+ endpoint_url: "" # Service endpoint
+ # Cloudflare R2: https://<account_id>.r2.cloudflarestorage.com
+ # Alibaba Cloud OSS: https://oss-cn-hangzhou.aliyuncs.com
+ # Tencent Cloud COS: https://cos.ap-guangzhou.myqcloud.com
+ bucket_name: "" # Bucket name
+ access_key_id: "" # Access key ID
+ secret_access_key: "" # Secret access key
+ region: "" # Region (optional; required by some providers)
+
+ # Data pull (sync from remote to local, for MCP Server, etc.)
+ pull:
+ enabled: false # Enable auto-pull on startup (true=on, false=off)
+ days: 7 # Pull the last N days of data
+
+
+# ===============================================================
+# 8. AI Model Configuration (shared by ai_analysis / ai_translation / ai_filter)
+# ===============================================================
+ai:
+ # LiteLLM model format: provider/model-name
+ # Examples:
+ # - deepseek/deepseek-v4-flash (DeepSeek; cheap and sufficient, recommended)
+ # - deepseek/deepseek-v4-pro
+ # - openai/gpt-4o (OpenAI)
+ # - gemini/gemini-2.5-flash (Google Gemini)
+ # - anthropic/claude-sonnet-4-20250514 (Anthropic)
+ # - ollama/llama3 (local Ollama)
+ # Full list: https://docs.litellm.ai/docs/providers
+
+ model: "deepseek/deepseek-v4-flash"
+
+ api_key: "" # API Key (prefer using the AI_API_KEY environment variable)
+
+ api_base: "" # Custom API URL (optional; leave empty in most cases)
+ #
+ # ❓ When do you need this?
+ # When your AI provider is not in the supported list above.
+ # For example, some API proxies, privately deployed services, etc.
+ # If you use DeepSeek, OpenAI, Gemini, etc., leave it empty.
+ #
+ # 🔧 How to fill it? Two steps:
+ # Step 1 — set api_base to the endpoint given by your provider
+ # e.g. https://your-provider.com/v1
+ #
+ # Step 2 — prefix the model with "openai/"
+ # e.g. openai/deepseek-ai/DeepSeek-V3
+ #
+ # 💡 Why the openai/ prefix?
+ # Most AI providers share a common API format.
+ # Adding openai/ tells the system "connect using this common format",
+ # so almost any provider can be hooked up.
+
+
+ timeout: 120 # Request timeout (seconds)
+
+ temperature: 1.0 # Sampling temperature (0.0-2.0)
+ # Note: some models (e.g. gpt-5) may require exactly 1.0, or they error
+
+ max_tokens: 5000 # Max generated tokens
+ # Note: if the API rejects this param (HTTP 400), set to 0 to stop sending it
+ # Advanced options
+ num_retries: 1 # Retry count on failure
+ fallback_models: [] # Fallback model list (optional)
+ # Example: ["openai/gpt-4o-mini", "openai/deepseek-ai/DeepSeek-V3"]
+
+ # Extra params (usually no need to change; uncomment to enable)
+ # extra_params:
+ # top_p: 1.0
+ # presence_penalty: 0.0
+ # stop: ["END"]
+
+
+# ===============================================================
+# 9. AI Analysis (model config is in the ai section above)
+# ===============================================================
+ai_analysis:
+ enabled: true # Enable AI analysis (true=on, false=off) — master switch
+ # Still the master switch once schedule is on: false=never analyze, true=controlled by schedule
+
+ language: "English" # Analysis report language (e.g. "English", "Chinese", "Korean")
+ prompt_file: "ai_analysis_prompt.txt" # Prompt file (relative to the config directory)
+
+ mode: "follow_report" # AI analysis mode (can differ from report.mode)
+ # follow_report = follow report.mode (default)
+ # daily / current / incremental = force the specified mode
+
+ max_news_for_analysis: 150 # Max number of news items for analysis (key to controlling token cost)
+ # Hot lists take the quota first; RSS uses the remainder; standalone is not limited
+
+ include_rss: false # Include RSS content in analysis (true=include, false=exclude)
+ include_standalone: true # Include standalone-region data (true=include, false=exclude)
+
+ include_rank_timeline: true # Rank-timeline detail level
+ # true = full trajectory (e.g. 1(09:30)→2(10:00)); more accurate but costs 0.5~1x more tokens
+ # false = simplified format (rank range + occurrence count); cheaper
+
+
+
+
+# ===============================================================
+# 10. AI Translation (model config is in the ai section above)
+#
+# Translates push titles; does not cover AI analysis content
+# ===============================================================
+ai_translation:
+ enabled: true # Enable translation (true=on, false=off)
+ language: "English" # Target language (e.g. "English", "Chinese", "Korean")
+ prompt_file: "ai_translation_prompt.txt" # Prompt file (relative to the config directory)
+
+ batch_size: 100 # Titles sent to the AI per batch; auto-batched beyond this
+ batch_interval: 2 # Batch interval (seconds) to avoid API rate limits; 0=no wait
+
+ # Translation scope (regions turned off in display.regions are never translated even if enabled here)
+ scope:
+ hotlist: false # Translate hot-list titles (true=translate, false=skip)
+ rss: true # Translate RSS titles (true=translate, false=skip)
+ standalone: true # Translate standalone-region titles (true=translate, false=skip)
+
+
+# ===============================================================
+# 11. Advanced Settings (usually no need to change)
+# ===============================================================
+advanced:
+ debug: false # Debug mode (true=verbose logs, false=normal)
+
+ # Version checks
+ version_check_url: "https://raw.githubusercontent.com/sansan0/TrendRadar/refs/heads/master/version"
+ mcp_version_check_url: "https://raw.githubusercontent.com/sansan0/TrendRadar/refs/heads/master/version_mcp"
+ configs_version_check_url: "https://raw.githubusercontent.com/sansan0/TrendRadar/refs/heads/master/version_configs"
+
+ # Hot-list crawler technical params
+ crawler:
+ request_interval: 2000 # Request interval (ms)
+ use_proxy: false # Enable proxy (true=on, false=off)
+ default_proxy: "http://127.0.0.1:10801"
+
+ # RSS settings
+ rss:
+ request_interval: 1000 # Request interval (ms)
+ timeout: 15 # Request timeout (seconds)
+ use_proxy: false # Use proxy (true=on, false=off)
+ proxy_url: "" # RSS-specific proxy (empty → use crawler.default_proxy)
+
+ # Sorting weights (used to re-rank hotlist items across platforms)
+ # Must sum to 1
+ weight:
+ rank: 0.6 # Rank weight
+ frequency: 0.3 # Frequency weight
+ hotness: 0.1 # Hotness weight
+
+ # Multi-account limit
+ max_accounts_per_channel: 3 # Max accounts per channel
+
+ # Internal params below (usually no need to change)
+ # Message batch size (bytes) — internal config, do not modify
+ batch_size:
+ default: 4000
+ dingtalk: 20000
+ feishu: 30000
+ bark: 4000
+ slack: 4000
+ batch_send_interval: 3 # Batch send interval (seconds)
+ feishu_message_separator: "━━━━━━━━━━━━━━━━"
diff --git a/config/frequency_words.en.txt b/config/frequency_words.en.txt
new file mode 100644
index 0000000000..88c7e4673d
--- /dev/null
+++ b/config/frequency_words.en.txt
@@ -0,0 +1,258 @@
+# ═══════════════════════════════════════════════════════════════
+# TrendRadar Frequency-words Configuration
+# Version: 1.1.0
+# ═══════════════════════════════════════════════════════════════
+
+# Visual config editor: https://sansan0.github.io/TrendRadar/
+#
+# Lines beginning with # are comments only.
+#
+# This file defines the news keywords you care about.
+# The system automatically crawls hot-list news containing these keywords and pushes them to you.
+#
+# The file has two sections:
+# [GLOBAL_FILTER] - Global filter: exclude content you don't want to see
+# [WORD_GROUPS] - Word groups: define keywords you want to follow
+#
+# ═══════════════════════════════════════════════════════════════
+
+
+# ───────────────────────────────────────────────────────────────
+# Global Filter
+# ───────────────────────────────────────────────────────────────
+# Write words you don't want to see here, one per line.
+# News containing these words is auto-excluded and won't appear in pushes.
+#
+# Usage:
+# clickbait A bare word; news containing "clickbait" is filtered
+# /foo|bar/ Wrap with /.../ to match multiple words (separated by |)
+
+[GLOBAL_FILTER]
+# Filter clickbait headlines
+震惊
+
+
+
+# ───────────────────────────────────────────────────────────────
+# Word Groups
+# ───────────────────────────────────────────────────────────────
+# Define the keywords you want to follow here.
+# Groups are separated by blank lines; keywords within a group are OR-related.
+#
+# ┌─────────────────────────────────────────────────────────────┐
+# │ Syntax cheat sheet │
+# └─────────────────────────────────────────────────────────────┘
+#
+# Keyword syntax:
+# keyword Plain keyword; matched if the title contains it
+# /regex/ Regex match (case-insensitive by default)
+# keyword => alias Give a keyword a display alias
+# [group alias] First line of a group; names the whole group
+# +keyword Required word; all required words must match
+# !keyword Exclude word; matching excludes that news item (current group only)
+# @number Limit how many items this group shows
+#
+# Display-name priority:
+# 1. Group alias present → show the group alias
+# 2. No group alias → show the joined aliases of each line (joined with " / ")
+# 3. No alias → show the keyword itself
+#
+#
+# ┌─────────────────────────────────────────────────────────────┐
+# │ Basics (recommended) │
+# └─────────────────────────────────────────────────────────────┘
+#
+# 1. Simplest: a bare keyword
+# ────────────────────
+# 华为
+#
+# Effect: matches all news containing "华为"
+#
+#
+# 2. Multiple keywords grouped together
+# ────────────────────
+# 华为
+# 鸿蒙
+# 任正非
+#
+# Effect: matches news containing "华为" OR "鸿蒙" OR "任正非"; shown as "华为 / 鸿蒙 / 任正非"
+#
+#
+# 3. Name the group (recommended)
+# ────────────────────
+# [华为]
+# 华为
+# 鸿蒙
+# 任正非
+#
+# Effect: same as above, but the display name is "华为" (more concise)
+#
+#
+# ┌─────────────────────────────────────────────────────────────┐
+# │ Advanced (optional) │
+# └─────────────────────────────────────────────────────────────┘
+#
+# 4. Match multiple words with a regex (one-liner)
+# ────────────────────
+# /华为|鸿蒙|任正非/ => 华为
+#
+# Effect: matches news containing "华为" OR "鸿蒙" OR "任正非"; shown as "华为"
+# Note: separate words inside /.../ with |; the part after => is the display name
+#
+# 💡 Don't know regex? Ask the AI:
+# "Write a regex that matches text containing '华为' or '鸿蒙' or '任正非'.
+# Format: /regex/ => display_name"
+#
+#
+# 5. Match an English word precisely (avoid false matches)
+# ────────────────────
+# /\bAI\b/i => AI
+#
+# Note: \b is a word boundary, to avoid matching "AI" inside "MAIL"
+# /i makes it case-insensitive: "ai", "AI", "Ai" all match
+#
+# 💡 Don't know regex? Ask the AI:
+# "Write a regex that precisely matches the English word 'AI' (not the AI in MAIL),
+# case-insensitive. Format: /regex/i => display_name"
+#
+#
+# 6. Exclude specific content
+# ────────────────────
+# [Apple Inc.]
+# 苹果
+# !水果
+# !果园
+#
+# Effect: matches "苹果" but excludes news containing "水果" or "果园"
+# Note: words starting with ! mean "exclude"
+#
+#
+# 7. Limit the number of items
+# ────────────────────
+# [Tech News]
+# 科技
+# @5
+#
+# Effect: shows at most 5 matching news items
+# Note: @number limits the count
+#
+#
+# 8. Require multiple words at once
+# ────────────────────
+# +苹果
+# +发布会
+#
+# Effect: must contain both "苹果" and "发布会" to match
+# Note: words starting with + mean "required"
+#
+# ───────────────────────────────────────────────────────────────
+
+[WORD_GROUPS]
+
+# ═══════════════════════════════════════════════════════════════
+# Companies & Brands
+# ═══════════════════════════════════════════════════════════════
+
+/胖东来|于东来/ => 胖东来
+
+/深度求索|幻方量化|梁文锋|\bDeepSeek\b/ => DeepSeek
+
+/华为|任正非|余承东|鸿蒙|海思|昇腾|鲲鹏|\bHUAWEI\b|\bHarmonyOS\b|\bHiSilicon\b/ => Huawei
+
+/比亚迪|王传福|方程豹|腾势|仰望|弗迪|刀片电池|云辇|\bBYD\b|\bDenza\b|\bYangwang\b/ => BYD
+
+/大疆|汪滔|灵眸|如影|\bDJI\b|\bRoboMaster\b|\bMavic\b|\bZenmuse\b/ => DJI
+
+/宇树|王兴兴|\bUnitree\b/ => Unitree Robotics
+
+/智元|灵犀|稚晖君|彭志辉|AgiBot/ => Agibot Robotics
+/众擎|EngineAI|赵同阳/ => EngineAI Robotics
+
+/黑神话|冯骥/ => Black Myth: Wukong
+
+/影之刃零|梁其伟/ => Blade of Fate
+
+/三体|流浪地球|刘慈欣|郭帆/ => Three-Body / Wandering Earth
+
+申奥
+
+/京东|刘强东|\bJD\b|\bJingdong\b/ => JD.com
+
+/字节|张一鸣|梁汝波|抖音|\bByteDance\b|\bTikTok\b|\bDouyin\b|\bLark\b|\bCapCut\b/ => ByteDance
+
+/腾讯|鹅厂|马化腾|微信|QQ|天美|阅文集团|微众银行|\bTencent\b|\bPony Ma\b|\bWeChat\b|\bLightSpeed\b|\bWeBank\b/ => Tencent
+
+/qwen|minimax|glm/ => Chinese Open-source Models
+
+/特斯拉|马斯克|\bTesla\b|\bElon Musk\b|\bCybertruck\b|\bModel 3\b|\bModel Y\b|\bModel S\b|\bModel X\b|\bFSD\b/ => Tesla
+
+/英伟达|黄仁勋|\bNVIDIA\b|\bGeForce\b|\bRTX\b|\bCUDA\b|\bJensen Huang\b/ => NVIDIA
+/苏姿丰|锐龙|霄龙|\bAMD\b|\bRyzen\b|\bEPYC\b|\bRadeon\b|\bLisa Su\b/ => AMD
+
+/微软|\bMicrosoft\b|\bWindows\b|\bAzure\b|\bSatya Nadella\b|\bCopilot\b/ => Microsoft
+/谷歌|皮查伊|安卓|油管|\bGoogle\b|\bAlphabet\b|\bAndroid\b|\bChrome\b|\bYouTube\b|\bGemini\b|\bDeepMind\b|\bWaymo\b/ => Google
+/库克|\biPhone\b|\biPad\b|\bMacBook\b|\biOS\b|\bVision Pro\b|\bAirPods\b|\bApple\b|\bTim Cook\b/ => Apple
+
+/\bOpenAI\b|\bChatGPT\b|\bSora\b|\bDALL-E\b|\bSam Altman\b|\bGreg Brockman\b/ => OpenAI
+/\bAnthropic\b|\bClaude\b|\bDario Amodei\b/ => Claude
+
+
+# ═══════════════════════════════════════════════════════════════
+# Countries & Regions
+# ═══════════════════════════════════════════════════════════════
+
+[China]
+国产
+中国
+
+[East Asia]
+日本
+朝鲜
+韩国
+
+[North America]
+美国
+加拿大
+
+[Western Europe]
+法国
+英国
+
+/俄罗斯|俄国/ => Russia
+
+印度
+
+
+# ═══════════════════════════════════════════════════════════════
+# Tech Domains
+# ═══════════════════════════════════════════════════════════════
+
+[AI]
+/(?<![a-zA-Z])ai(?![a-zA-Z])/
+人工智能
+
+[Chips]
+芯片
+光刻机
+半导体
+
+/水电|雅鲁藏布江/ => Hydropower
+/光伏|太阳能/ => Solar Power
+核能
+能源
+
+/自动驾驶|无人驾驶|智驾/ => Autonomous Driving
+
+机器人
+/机械狗|四足/ => Robot Dog
+具身智能
+
+/月球|登月|火星|宇宙|飞船|航天|空间站|卫星/ => Aerospace
+
+# Frontier tech
+量子
+脑机
+基因
+
+# Industrial policy
+生产力
diff --git a/config/timeline.en.yaml b/config/timeline.en.yaml
new file mode 100644
index 0000000000..22643d7129
--- /dev/null
+++ b/config/timeline.en.yaml
@@ -0,0 +1,560 @@
+# ═══════════════════════════════════════════════════════════════
+# TrendRadar Timeline Configuration
+# Version: 1.2.0
+# ═══════════════════════════════════════════════════════════════
+#
+# This file controls "what to do, and when".
+#
+# Most people don't need to edit this file.
+# Just pick a preset template in config.yaml:
+#
+# schedule:
+# preset: "morning_evening" ← change it here
+#
+#
+# Visual config editor: https://sansan0.github.io/TrendRadar/
+#
+#
+# ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
+# 📖 Core concepts (to help you understand the config below)
+# ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
+#
+#
+# 🔁 How does the program run?
+#
+# TrendRadar doesn't run in the background constantly; it's woken up periodically by a "timer alarm":
+#
+# GitHub Actions users → triggered by the cron in .github/workflows/crawler.yml
+# runs once per hour by default (e.g. at minute 33 of each hour)
+#
+# Docker users → triggered by CRON_SCHEDULE in docker/.env
+# runs every 30 minutes by default
+#
+# Each time it's woken, the program runs through three phases in order:
+#
+# 1️⃣ Collect
+# Crawl the latest data from hot-list platforms + RSS feeds, store it in the database
+#
+# ⬇
+#
+# 2️⃣ Analyze
+# Call an AI model to deeply analyze the collected news (optional; needs an API key)
+#
+# ⬇
+#
+# 3️⃣ Push
+# Send the organized hot news + AI analysis to your notification channels
+# (Feishu, DingTalk, Telegram, email, etc.)
+#
+# All three phases can be toggled independently. This file controls:
+# "in which time periods, which phases are on/off".
+#
+#
+# 🔌 Master switches in config.yaml vs. timeline period switches
+#
+# config.yaml has several "master switches" that take precedence over this file:
+#
+# platforms.enabled: false → never crawl hot lists (regardless of timeline)
+# rss.enabled: false → never crawl RSS (same)
+# notification.enabled: false → never push (same)
+# ai_analysis.enabled: false → never analyze (same)
+#
+# A period switch only takes effect when its master switch is true.
+# In other words: the master switch decides "can it happen"; timeline decides "when".
+#
+#
+# ⏰ What are "periods" and "silent periods"?
+#
+# Picture a day as a timeline divided into several "periods".
+# Each period has its own behavior toggles (collect? analyze? push?).
+#
+# Time not inside any period is a "silent period" (uses the default config).
+# Silent periods must usually still collect, so data keeps accumulating,
+# and when it's time to push, a complete report can be assembled.
+#
+#
+# 💡 The longer the silent periods, the richer the accumulated data (rank trajectories,
+# entry/exit times, etc.), and the more complete the context fed to the AI for analysis,
+# yielding higher-quality analysis. Compared to the MCP Server, this approach's all-day data
+# shows fuller hotness trends and change arcs.
+#
+#
+# ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
+# 📋 Preset templates at a glance (just pick one)
+# ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
+#
+# 1️⃣ always_on Always on, push whenever there's new (default)
+# 2️⃣ morning_evening Push all day + an evening summary (recommended for most)
+# 3️⃣ office_hours Three-block workday: onboarding brief → noon hot → wrap-up summary
+# 4️⃣ night_owl Afternoon brief + late-night full-day summary
+# 5️⃣ custom Fully custom (edit the custom section at the bottom of this file)
+#
+# Want to customize? Two ways:
+# 1. Jump straight to the "Custom mode" section at the bottom of this file
+# 2. Add your own preset template in the presets below
+# (just keep the key unique, then put your template name in config.yaml)
+#
+# ⚠️ Notes on period design:
+# GitHub Actions: a timer interval ≥ 2 hours is recommended. Since system triggers have random
+# latency, too-short intervals may cause missed runs.
+# Docker users: cron timing is exact, no such limit; set as needed.
+#
+#
+# ═══════════════════════════════════════════════════════════════
+
+
+# ───────────────────────────────────────────────────────────────
+# Preset templates
+# ───────────────────────────────────────────────────────────────
+presets:
+
+ # ───────────────────────────────────────────────────────────
+ # 1️⃣ always_on - always-on monitoring
+ #
+ # Simplest mode: collect + push all day; notify you as soon as anything new appears.
+ # No periods; one config for the whole day.
+ # For: power users, real-time public-opinion monitoring
+ #
+ # All day: push ✓ | AI analysis ✗ | unlimited pushes
+ # ───────────────────────────────────────────────────────────
+ always_on:
+ name: "Always-on Monitoring"
+ description: "Monitors all day; pushes immediately on anything new. For power users."
+
+ # Default config ── used when not inside any period
+ # Since this mode has no periods, default is the all-day behavior
+ default:
+ collect: true # Collect data (crawl hot lists + RSS)
+ analyze: false # No AI analysis (saves API cost)
+ ai_mode: "current" # AI analyzes the current ranking
+ push: true # Push when there's new content
+ report_mode: "incremental" # Push only new content to avoid duplication
+ once: # Limit to once per period
+ analyze: false # no limit on analysis count
+ push: false # no limit on push count
+
+ # No periods defined; the whole day uses default
+ #
+ # Syntax note: {} is YAML's "empty map", meaning nothing inside.
+ # It's equivalent to writing it multi-line but filling in nothing. [] below is the same, an "empty list".
+ periods: {}
+ day_plans:
+ all_day:
+ periods: [] # Empty list = no periods active this day
+ week_map:
+ 1: "all_day" # Mon
+ 2: "all_day" # Tue
+ 3: "all_day" # Wed
+ 4: "all_day" # Thu
+ 5: "all_day" # Fri
+ 6: "all_day" # Sat
+ 7: "all_day" # Sun
+
+
+ # ───────────────────────────────────────────────────────────
+ # 2️⃣ morning_evening - morning/evening summary (recommended)
+ #
+ # Push current hotspots all day + a full-day summary in the evening.
+ # For: most people
+ #
+ # Default (all day): push ✓ | AI analysis ✓ | unlimited pushes
+ # Evening summary: push ✓ | AI analysis ✓ | push/analyze once
+ # ───────────────────────────────────────────────────────────
+ morning_evening:
+ name: "Morning/Evening Summary"
+ description: "Push all day + an evening same-day summary. For most people."
+
+ # Default config ── behavior when no period matches
+ default:
+ collect: true # Always collect
+ analyze: true # AI analyzes the current ranking
+ ai_mode: "current" # AI analyzes the current ranking
+ push: true # Push current on-list hotspots each time
+ report_mode: "current" # Currently-on-list news
+ # frequency_file: "xxx.txt" # Keyword file (optional, in config/custom/keyword/)
+ # interests_file: "xxx.txt" # AI interest file (optional, in config/custom/ai/)
+ # filter_method: "keyword" # Filter strategy (optional: keyword | ai; empty → global filter.method)
+ once:
+ analyze: false # No limit on analysis count
+ push: false # No limit on push count
+
+ # Period definitions ── only the evening summary needs special handling
+ periods:
+ evening_summary:
+ name: "Evening Summary"
+ start: "20:00"
+ end: "22:00"
+ # frequency_file: "xxx.txt" # Keyword file (optional, in config/custom/keyword/)
+ # interests_file: "xxx.txt" # AI interest file (optional, in config/custom/ai/)
+ # filter_method: "keyword" # Filter strategy (optional: keyword | ai; empty → global filter.method)
+ analyze: true # AI analysis in the evening
+ ai_mode: "daily" # AI summarizes the whole day
+ report_mode: "daily" # Switch to all-news-of-the-day summary
+ once:
+ analyze: true # Analyze once within the window
+ push: true # Push once within the window
+
+ # Day plan ── assemble periods into a day's schedule
+ day_plans:
+ all_day:
+ periods: ["evening_summary"]
+
+ # Week map ── which day plan each day uses (1=Mon ... 7=Sun)
+ week_map:
+ 1: "all_day"
+ 2: "all_day"
+ 3: "all_day"
+ 4: "all_day"
+ 5: "all_day"
+ 6: "all_day"
+ 7: "all_day"
+
+
+ # ───────────────────────────────────────────────────────────
+ # 3️⃣ office_hours - office-hours push
+ #
+ # Three-block push on workdays, free incremental on weekends.
+ # For: office workers, enterprise users
+ #
+ # Default (silent): push ✗ | AI analysis ✗
+ # Onboarding brief: push ✓ | AI analysis ✓ | once
+ # Noon hot: push ✓ | AI analysis ✗ | once
+ # Wrap-up summary: push ✓ | AI analysis ✓ | once
+ # Weekend free: push ✓ | AI analysis ✗ | unlimited pushes
+ # ───────────────────────────────────────────────────────────
+ office_hours:
+ name: "Office Hours"
+ description: "Three-block workday push (onboarding → noon → wrap-up); free incremental on weekends."
+
+ default:
+ collect: true
+ analyze: false
+ ai_mode: "current"
+ push: false # No push by default
+ report_mode: "current"
+ once:
+ analyze: true # Analyze once per period
+ push: true # Push once per period
+
+ periods:
+ morning_briefing:
+ name: "Morning Briefing"
+ start: "09:00"
+ end: "11:00"
+ analyze: true # AI analyzes current hotspots
+ ai_mode: "current" # AI analyzes the current ranking
+ push: true # See current hotspots after arriving
+ report_mode: "current" # Currently-on-list news
+ # once inherits default (analyze: true, push: true) → push/analyze once
+
+ noon_update:
+ name: "Noon Hot"
+ start: "13:00"
+ end: "15:00"
+ push: true # Push current on-list hotspots at noon
+ report_mode: "current" # Currently-on-list news
+ # analyze inherits default: false → no AI analysis at noon, saves API
+ # once inherits default (push: true) → push once
+
+ closing_summary:
+ name: "Wrap-up Summary"
+ start: "17:00"
+ end: "19:00"
+ analyze: true # AI does a full-day summary analysis
+ ai_mode: "daily" # AI analyzes the whole day
+ push: true # Push the full same-day summary before leaving
+ report_mode: "daily" # All-news-of-the-day summary
+ # once inherits default (analyze: true, push: true) → push/analyze once
+
+ weekend_free:
+ name: "Weekend Free"
+ start: "08:00"
+ end: "23:00"
+ ai_mode: "current" # AI analyzes the current ranking
+ push: true # Push when there's new
+ report_mode: "incremental" # Incremental: push only on new; otherwise quiet
+ once:
+ analyze: false # No limit on analysis count
+ push: false # No limit on push count
+
+ # Workdays use the three-block push; weekends use the free incremental mode
+ day_plans:
+ workday:
+ periods: ["morning_briefing", "noon_update", "closing_summary"]
+ weekend:
+ periods: ["weekend_free"] # Weekend: push only new content; avoids disturbing sleep
+
+ week_map:
+ 1: "workday" # Mon → workday plan
+ 2: "workday"
+ 3: "workday"
+ 4: "workday"
+ 5: "workday"
+ 6: "weekend" # Sat → weekend plan
+ 7: "weekend" # Sun → weekend plan
+
+
+ # ───────────────────────────────────────────────────────────
+ # 4️⃣ night_owl - night-owl mode
+ #
+ # Quiet by day; one push each in the afternoon and late at night.
+ # For: night workers, users in different time zones, freelancers
+ #
+ # Default (day silent): push ✗ | AI analysis ✗
+ # Afternoon brief: push ✓ | AI analysis ✓ | once
+ # Late-night summary: push ✓ | AI analysis ✓ | once
+ # ───────────────────────────────────────────────────────────
+ night_owl:
+ name: "Night Owl"
+ description: "Afternoon brief + late-night full-day summary. For night workers and international users."
+
+ default:
+ collect: true
+ analyze: false
+ ai_mode: "current"
+ push: false
+ report_mode: "current"
+ once:
+ analyze: true # Analyze once per period
+ push: true # Push once per period
+
+ periods:
+ afternoon_peek:
+ name: "Afternoon Brief"
+ start: "15:00"
+ end: "17:00"
+ analyze: true # AI analyzes current hotspots
+ ai_mode: "current" # AI analyzes the current ranking
+ push: true # See current hotspots in the afternoon
+ report_mode: "current" # Currently-on-list news
+ # once inherits default (analyze: true, push: true) → push/analyze once
+
+ late_night:
+ name: "Late-night Summary"
+ start: "22:00"
+ end: "01:00" # start > end → auto-detected as cross-midnight
+ analyze: true # AI does a full-day summary analysis
+ ai_mode: "daily" # AI analyzes the whole day
+ push: true # Push the full same-day summary late at night
+ report_mode: "daily" # All-news-of-the-day summary
+ # once inherits default (analyze: true, push: true) → push/analyze once
+
+ day_plans:
+ all_day:
+ periods: ["afternoon_peek", "late_night"]
+ week_map:
+ 1: "all_day"
+ 2: "all_day"
+ 3: "all_day"
+ 4: "all_day"
+ 5: "all_day"
+ 6: "all_day"
+ 7: "all_day"
+
+
+# ═══════════════════════════════════════════════════════════════
+#
+# 5️⃣ Custom Mode
+#
+# When config.yaml sets schedule.preset: "custom",
+# the system reads the config block below.
+#
+# If the presets above don't fit your needs, define your own freely here.
+#
+# ═══════════════════════════════════════════════════════════════
+#
+# The idea behind a custom config is simple — like building blocks:
+#
+# Step 1: Define "blocks" (periods)
+# Each block = a time period + what to do in it
+# e.g. morning 08-10 push, evening 19-21 summary
+#
+# Step 2: Assemble "a day's plan" (day_plans)
+# Combine blocks into a day's schedule
+# e.g. workday uses [morning, evening], weekend uses [evening]
+#
+# Step 3: Assign "which plan each day uses" (week_map)
+# Mon–Sun each map to a day plan
+# e.g. Mon–Fri use workday, Sat–Sun use weekend
+#
+# There's also a "default config" — used when a moment isn't inside any block.
+# Fields not written inside a block also fall back to the default.
+#
+#
+# Below is a full custom example with different schedules for workdays and weekends:
+#
+# Workday periods:
+# Late-night quiet 23:00-06:00 (cross-midnight): collect ✓ | analyze ✓ | push ✗
+# Workday morning 08:00-10:00: push ✓ | incremental
+# Evening summary 19:00-21:00: push ✓ | analyze ✓ | daily
+# Other times use the default config (silent collect)
+#
+# Weekend periods:
+# Late-night quiet 23:00-06:00 (cross-midnight): collect ✓ | analyze ✓ | push ✗
+# Weekend morning 10:00-12:00: push ✓ | daily
+# Evening summary 19:00-21:00: push ✓ | analyze ✓ | daily
+# Other times use the default config (silent collect)
+
+custom:
+ name: "Custom"
+ description: "Freely define periods, day plans, and the week map."
+
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ # Default config
+ #
+ # Used when the current moment isn't inside any period (block).
+ # Fields not written in a period also fall back here.
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ default:
+ collect: true # Collect data (crawl hot lists + RSS)
+ analyze: false # Run AI analysis
+ ai_mode: "current" # AI analysis mode:
+ # follow_report → follow report_mode
+ # daily → force full-day summary
+ # current → force current ranking
+ # incremental → force incremental mode
+ push: false # Send push notifications
+ report_mode: "current" # Report mode:
+ # daily → summary of all news of the day
+ # current → currently-on-list news
+ # incremental → push only new content
+
+
+ # frequency_file: "general.txt"
+ # Keyword file (optional, in config/custom/keyword/)
+ # Empty → uses the default config/frequency_words.txt
+ # A period can also set this to override the default
+ # e.g. the evening summary uses a tech keyword library:
+ # frequency_file: "tech.txt"
+ # Note: only effective when filter_method is keyword
+
+ # interests_file: "finance.txt"
+ # AI interest description file (optional, in config/custom/ai/)
+ # Empty → uses the default config/ai_interests.txt
+ # A period can also set this to override the default
+ # e.g. the evening summary uses finance interests:
+ # interests_file: "finance.txt"
+ # Note: only effective when filter_method is ai
+
+ # filter_method: "keyword" # Filter strategy (optional: keyword | ai)
+ # Empty → uses the global config.yaml filter.method
+ # A period can also set this to override
+ # e.g. the evening summary uses AI filtering:
+ # filter_method: "ai"
+ once:
+ analyze: true # Analyze once within the period (saves API cost)
+ push: true # Push once within the period (fewer interruptions)
+
+
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ # Step 1: Define blocks (periods)
+ #
+ # Each period has a unique key (e.g. deep_quiet),
+ # and start / end for its active time range.
+ #
+ # Only write "fields that differ from default"; the rest inherit default.
+ # e.g. weekday_morning doesn't write collect, so it inherits default's collect: true.
+ #
+ # Tip: if start > end (e.g. 22:00 → 07:00),
+ # it's auto-detected as a cross-midnight period.
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ periods:
+
+ deep_quiet:
+ name: "Late-night Quiet"
+ start: "23:00"
+ end: "06:00" # 23:00 → 06:00 next day (cross-midnight period)
+ # frequency_file: "xxx.txt" # Keyword file (optional, in config/custom/keyword/)
+ # interests_file: "xxx.txt" # AI interest file (optional, in config/custom/ai/)
+ # filter_method: "keyword" # Filter strategy (optional: keyword | ai; empty → global filter.method)
+ collect: true # Keep collecting at night
+ analyze: true # AI analysis can run at night (no push anyway)
+ push: false # No push late at night to avoid disturbance
+
+ weekday_morning:
+ name: "Workday Morning"
+ start: "08:00"
+ end: "10:00" # 2h span, ample trigger margin
+ # frequency_file: "xxx.txt" # Keyword file (optional, in config/custom/keyword/)
+ # interests_file: "xxx.txt" # AI interest file (optional, in config/custom/ai/)
+ # filter_method: "keyword" # Filter strategy (optional: keyword | ai; empty → global filter.method)
+ push: true # One push in the morning
+ report_mode: "incremental" # Push only new content
+ # once inherits default (push: true) → push once within the window
+
+ weekend_morning:
+ name: "Weekend Morning"
+ start: "10:00"
+ end: "12:00" # 2h span
+ # frequency_file: "xxx.txt" # Keyword file (optional, in config/custom/keyword/)
+ # interests_file: "xxx.txt" # AI interest file (optional, in config/custom/ai/)
+ # filter_method: "keyword" # Filter strategy (optional: keyword | ai; empty → global filter.method)
+ push: true
+ report_mode: "daily" # Weekend: see the all-day summary
+ # once inherits default (push: true) → push once within the window
+
+ evening_summary:
+ name: "Evening Summary"
+ start: "19:00"
+ end: "21:00"
+ # frequency_file: "xxx.txt" # Keyword file (optional, in config/custom/keyword/)
+ # interests_file: "xxx.txt" # AI interest file (optional, in config/custom/ai/)
+ # filter_method: "keyword" # Filter strategy (optional: keyword | ai; empty → global filter.method)
+ analyze: true # AI analysis in the evening
+ ai_mode: "daily" # AI analyzes the whole day
+ push: true # Evening push
+ report_mode: "daily" # All-news-of-the-day summary
+ # once inherits default (analyze: true, push: true) → analyze/push once
+
+
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ # Step 2: Assemble blocks into day plans
+ #
+ # Combine the periods above into a day's schedule.
+ # You can define multiple day plans (e.g. workday and weekend),
+ # then assign them to different weekdays in the week_map in Step 3.
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ day_plans:
+ workday: # Workday plan
+ periods: ["deep_quiet", "weekday_morning", "evening_summary"]
+ weekend: # Weekend plan (swap weekday_morning for weekend_morning)
+ periods: ["deep_quiet", "weekend_morning", "evening_summary"]
+
+
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ # Step 3: Assign which day plan each day uses
+ #
+ # 1=Mon 2=Tue 3=Wed 4=Thu 5=Fri 6=Sat 7=Sun
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ week_map:
+ 1: "workday" # Mon → workday plan
+ 2: "workday" # Tue
+ 3: "workday" # Wed
+ 4: "workday" # Thu
+ 5: "workday" # Fri
+ 6: "weekend" # Sat → weekend plan
+ 7: "weekend" # Sun
+
+
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ # Overlap policy (usually no need to change)
+ #
+ # What is an "overlap"?
+ # If two of your periods overlap (e.g. A is 08:00-12:00, B is 10:00-14:00),
+ # then 10:00-12:00 belongs to both A and B — an overlap.
+ # The program then needs to know: which one wins?
+ #
+ # Two options:
+ #
+ # error_on_overlap (recommended)
+ # Returns an error immediately, prompting you to fix the config.
+ # For most people — overlapping periods are usually mistakes; an error catches them early.
+ #
+ # last_wins
+ # In the day_plans periods list, the later one wins.
+ # e.g. periods: ["A", "B"] → on overlap, B takes effect.
+ # For cases: you want a wide period as the base, then a later small one to override.
+ #
+ # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+ overlap:
+ policy: "error_on_overlap"
diff --git a/docs/assets/i18n.js b/docs/assets/i18n.js
new file mode 100644
index 0000000000..756973d2fe
--- /dev/null
+++ b/docs/assets/i18n.js
@@ -0,0 +1,667 @@
+/**
+ * TrendRadar i18n - Internationalization Engine
+ */
+(function () {
+ 'use strict';
+
+ const STORAGE_KEY_LANG = 'trendradar_lang';
+ let currentLang = 'zh';
+
+ const T = { zh: {}, en: {} };
+
+ function add(entries) {
+ entries.forEach(function (e) {
+ T.zh[e[0]] = e[1];
+ T.en[e[0]] = e[2];
+ });
+ }
+
+ // ═══════════════════════════════════════
+ // Navigation & Top Bar
+ // ═══════════════════════════════════════
+ add([
+ ['nav.subtitle', '可视化配置编辑器', 'Visual Config Editor'],
+ ['nav.privacy', '纯静态页面,数据仅保存在你的本地浏览器,请放心使用', 'Static page — data is stored only in your browser'],
+ ['nav.loadLatest', '加载官网最新配置', 'Load Latest Config'],
+ ['nav.copyConfig', '复制配置', 'Copy Config'],
+ ['nav.copied', '已复制!', 'Copied!'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Save Status
+ // ═══════════════════════════════════════
+ add([
+ ['save.saved', '已保存: ', 'Saved: '],
+ ['save.notSaved', '未保存', 'Not saved'],
+ ['time.justNow', '刚刚', 'Just now'],
+ ['time.minutesAgo', ' 分钟前', ' min ago'],
+ ['time.hoursAgo', ' 小时前', ' hr ago'],
+ ['time.daysAgo', ' 天前', ' days ago'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Right Panel Header
+ // ═══════════════════════════════════════
+ add([
+ ['panel.configModules', '配置模块', 'Config Modules'],
+ ['panel.frequencyEdit', '频率词编辑', 'Keyword Editing'],
+ ['panel.timelineSchedule', '时间线调度', 'Timeline Schedule'],
+ ['panel.versionCheck', '版本检测', 'Check Version'],
+ ['panel.readOnly', '只读 (请在左侧编辑)', 'Read-only (edit on the left)'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Module Names (MODULE_DEFS)
+ // ═══════════════════════════════════════
+ add([
+ ['mod.app', '1. 基础设置', '1. Basic Settings'],
+ ['mod.platforms', '2. 数据源 - 热榜平台', '2. Data Source - Hot Platforms'],
+ ['mod.rss', '3. 数据源 - RSS 订阅', '3. Data Source - RSS Feeds'],
+ ['mod.report', '4. 报告模式', '4. Report Mode'],
+ ['mod.filter', '4.5 筛选策略', '4.5 Filter Strategy'],
+ ['mod.ai_filter', '4.6 AI 智能筛选', '4.6 AI Smart Filter'],
+ ['mod.display', '5. 推送内容控制', '5. Push Content Control'],
+ ['mod.notification', '6. 推送通知', '6. Push Notification'],
+ ['mod.storage', '7. 存储配置', '7. Storage Config'],
+ ['mod.ai', '8. AI 模型配置', '8. AI Model Config'],
+ ['mod.ai_analysis', '9. AI 分析功能', '9. AI Analysis'],
+ ['mod.ai_translation', '10. AI 翻译功能', '10. AI Translation'],
+ ['mod.advanced', '11. 高级设置', '11. Advanced Settings'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Control Labels (renderControls)
+ // ═══════════════════════════════════════
+ add([
+ // Platforms
+ ['ctrl.enableHotlist', '启用热榜抓取', 'Enable hot list crawling'],
+ ['ctrl.platformList', '平台列表', 'Platform List'],
+ ['ctrl.dragToSort', '可拖拽排序', 'drag to reorder'],
+ ['ctrl.addPlatform', '添加平台', 'Add Platform'],
+ ['ctrl.addOtherPlatform', '添加其它平台', 'Add Other Platforms'],
+
+ // RSS
+ ['ctrl.enableRss', '启用 RSS 抓取', 'Enable RSS crawling'],
+ ['ctrl.freshnessFilter', '新鲜度过滤', 'Freshness Filter'],
+ ['ctrl.enableFreshness', '启用新鲜度过滤', 'Enable freshness filter'],
+ ['ctrl.maxAgeDays', '最大文章年龄 (天)', 'Max article age (days)'],
+ ['ctrl.rssFeedList', 'RSS 源列表', 'RSS Feed List'],
+ ['ctrl.addRss', '添加 RSS 源', 'Add RSS Feed'],
+ ['ctrl.rssLibHint', '(内附 RSS 源参考库)', '(RSS feed reference library included)'],
+ ['ctrl.rssWarning', '部分海外媒体内容可能涉及敏感话题,AI 模型可能拒绝翻译或分析,建议根据实际需求筛选订阅源。', 'Some overseas media may involve sensitive topics. AI models may refuse to translate or analyze. Filter feeds based on actual needs.'],
+
+ // Report
+ ['ctrl.reportMode', '报告模式', 'Report Mode'],
+ ['ctrl.displayMode', '分组维度', 'Group Dimension'],
+ ['ctrl.sortByPosition', '按定义顺序排序', 'Sort by defined order'],
+ ['ctrl.rankThreshold', '排名高亮阈值', 'Rank highlight threshold'],
+ ['ctrl.maxNewsPerKeyword', '每个关键词最大显示数量', 'Max items per keyword'],
+
+ // Filter
+ ['ctrl.filterMethod', '筛选方法', 'Filter Method'],
+ ['ctrl.prioritySort', 'AI 模式按标签优先级排序', 'AI mode: sort by tag priority'],
+ ['ctrl.filterNote', '使用', 'uses'],
+
+ // AI Filter
+ ['ctrl.aiFilterNote', '仅当 filter.method=ai 时生效。', 'Only effective when filter.method=ai.'],
+ ['ctrl.batchSize', '每批标题数量', 'Titles per batch'],
+ ['ctrl.batchInterval', '分批间隔 (秒)', 'Batch interval (sec)'],
+ ['ctrl.minScore', '最低分数阈值 (0~1)', 'Min score threshold (0~1)'],
+ ['ctrl.interestsFile', '兴趣描述文件 (可选)', 'Interests file (optional)'],
+ ['ctrl.interestsFileHint', '留空时使用', 'When empty, uses'],
+ ['ctrl.reclassifyThreshold', '全量重分类阈值 (0~1)', 'Full reclassification threshold (0~1)'],
+ ['ctrl.promptFile', '分类提示词文件', 'Classification prompt file'],
+ ['ctrl.extractPromptFile', '标签提取提示词文件', 'Tag extraction prompt file'],
+ ['ctrl.updateTagsPromptFile', '标签更新提示词文件', 'Tag update prompt file'],
+
+ // Display
+ ['ctrl.pushContentControl', '推送内容控制', 'Push Content Control'],
+ ['ctrl.displayOrderHint', '列表顺序决定了报告中的显示顺序', 'List order determines display order in the report'],
+ ['ctrl.standaloneConfig', '独立展示区配置', 'Standalone Display Config'],
+ ['ctrl.standaloneNote', '推送展示由上方开关控制,AI 分析由 AI 模块的开关独立控制', 'Push display is controlled by toggles above; AI analysis is controlled independently by the AI module'],
+ ['ctrl.maxStandaloneItems', '每个源最多展示条数', 'Max items per source'],
+ ['ctrl.selectPlatforms', '选择要展示的热榜平台', 'Select hot list platforms to display'],
+ ['ctrl.selectRssFeeds', '选择要展示的 RSS 源', 'Select RSS feeds to display'],
+
+ // Notification
+ ['ctrl.notificationNote', '推送时间由 timeline.yaml 控制,切换到 timeline.yaml 标签页可可视化编辑调度规则。此处仅配置通知渠道(Telegram / 企业微信等),请在左侧编辑器中修改。', 'Push timing is controlled by timeline.yaml. Switch to the timeline.yaml tab for visual schedule editing. Configure notification channels (Telegram / WeCom, etc.) in the left editor.'],
+
+ // AI
+ ['ctrl.modelName', '模型名称', 'Model Name'],
+ ['ctrl.apiKey', 'API Key', 'API Key'],
+ ['ctrl.apiBase', 'API Base URL (可选)', 'API Base URL (optional)'],
+ ['ctrl.timeout', '请求超时 (秒)', 'Request timeout (sec)'],
+ ['ctrl.temperature', '采样温度 (0.0-2.0)', 'Temperature (0.0-2.0)'],
+ ['ctrl.maxTokens', '最大生成 Token 数', 'Max tokens'],
+
+ // AI Analysis
+ ['ctrl.enableAnalysis', '开启 AI 分析报告', 'Enable AI analysis report'],
+ ['ctrl.analysisTimeNote', 'AI 分析的执行时间已由 timeline.yaml 统一控制。', 'AI analysis timing is now controlled by timeline.yaml.'],
+ ['ctrl.analysisContentConfig', '分析内容配置', 'Analysis Content Config'],
+ ['ctrl.outputLanguage', '输出语言', 'Output Language'],
+ ['ctrl.promptConfigFile', '提示词配置文件', 'Prompt config file'],
+ ['ctrl.aiAnalysisMode', 'AI 分析模式', 'AI Analysis Mode'],
+ ['ctrl.maxNewsForAnalysis', '最大分析条数', 'Max items for analysis'],
+ ['ctrl.includeRss', '包含 RSS 内容', 'Include RSS content'],
+ ['ctrl.includeStandalone', '包含独立展示区数据', 'Include standalone data'],
+ ['ctrl.includeRankTimeline', '传递完整排名时间线', 'Pass full rank timeline'],
+
+ // AI Translation
+ ['ctrl.enableTranslation', '开启 AI 自动翻译', 'Enable AI auto-translation'],
+ ['ctrl.targetLanguage', '目标语言', 'Target Language'],
+ ['ctrl.translationBatchSize', '每批翻译标题数', 'Titles per translation batch'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Display Regions
+ // ═══════════════════════════════════════
+ add([
+ ['region.hotlist', '热榜区域', 'Hot List'],
+ ['region.new_items', '新增热点区域', 'New Items'],
+ ['region.rss', 'RSS 订阅区域', 'RSS Feeds'],
+ ['region.standalone', '独立展示区', 'Standalone'],
+ ['region.ai_analysis', 'AI 分析区域', 'AI Analysis'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Toast Messages
+ // ═══════════════════════════════════════
+ add([
+ ['toast.configRestored', '已恢复上次保存的配置', 'Previous config restored'],
+ ['toast.manualSave', '已手动保存配置', 'Config saved manually'],
+ ['toast.resetDone', '已重置为初始状态', 'Reset to initial state'],
+ ['toast.loadingConfig', '正在加载最新配置...', 'Loading latest config...'],
+ ['toast.loaded', '已加载: ', 'Loaded: '],
+ ['toast.loadFailed', '加载失败: ', 'Load failed: '],
+ ['toast.yamlError', 'YAML 语法错误: ', 'YAML syntax error: '],
+ ['toast.fileReadFail', '文件读取失败', 'File read failed'],
+ ['toast.selectOneFile', '请至少选择一个文件', 'Please select at least one file'],
+ ['toast.allSourcesFailed', '所有源均不可用,请检查网络连接', 'All sources unavailable, check network connection'],
+ ['toast.updatedToLatest', '已更新到最新版本', 'Updated to latest version'],
+ ['toast.updateFailed', '更新失败: ', 'Update failed: '],
+ ['toast.loadingLatest', '正在加载最新版本...', 'Loading latest version...'],
+ ['toast.versionCheckFailed', '版本检测失败: ', 'Version check failed: '],
+ ['toast.platformAdded', '平台 {0} 已添加', 'Platform {0} added'],
+ ['toast.switchedToMode', '已切换至「{0}」模式', 'Switched to "{0}" mode'],
+ ['toast.presetCreated', '调度模式「{0}」创建成功', 'Schedule mode "{0}" created'],
+ ['toast.periodAdded', '时间段「{0}」添加成功', 'Period "{0}" added'],
+ ['toast.periodDeleted', '时间段「{0}」已删除', 'Period "{0}" deleted'],
+ ['toast.duplicatedAs', '已复制为「{0}」', 'Duplicated as "{0}"'],
+ ['toast.presetDeleted', '调度模式「{0}」已删除', 'Schedule mode "{0}" deleted'],
+ ['toast.dayPlanAdded', '日计划「{0}」已添加', 'Day plan "{0}" added'],
+ ['toast.dayPlanDeleted', '日计划「{0}」已删除', 'Day plan "{0}" deleted'],
+ ['toast.weekMapUpdated', '周映射已更新', 'Week map updated'],
+ ['toast.builtinNoDelete', '内置预设不可删除,可使用复制功能', 'Built-in presets cannot be deleted. Use duplicate instead.'],
+ ['toast.customNoDelete', 'custom 模式不可删除', 'Custom mode cannot be deleted'],
+ ['toast.enterPresetKey', '请输入模式标识 (key)', 'Please enter mode key'],
+ ['toast.invalidKey', 'key 仅支持英文、数字和下划线,且不能以数字开头', 'Key: letters, digits and underscores only, cannot start with a digit'],
+ ['toast.enterName', '请输入显示名称', 'Please enter display name'],
+ ['toast.presetExists', '预设「{0}」已存在', 'Preset "{0}" already exists'],
+ ['toast.noCustomKey', '不能使用 "custom" 作为预设名', 'Cannot use "custom" as a preset name'],
+ ['toast.enterPeriodKey', '请输入时间段标识 (key)', 'Please enter period key'],
+ ['toast.enterPeriodName', '请输入显示名称', 'Please enter display name'],
+ ['toast.setTime', '请设置开始和结束时间', 'Please set start and end time'],
+ ['toast.sameTime', '开始时间和结束时间不能相同', 'Start and end time cannot be the same'],
+ ['toast.periodExists', '时间段「{0}」已存在', 'Period "{0}" already exists'],
+ ['toast.presetSectionNotFound', '未找到预设配置段', 'Preset config section not found'],
+ ['toast.periodsNotFound', '未找到 periods 配置段', 'Periods config section not found'],
+ ['toast.noDayPlans', '没有可用的日计划', 'No day plans available'],
+ ['toast.needTwoDayPlans', '需要至少两个日计划来分离工作日/周末', 'Need at least two day plans to separate weekday/weekend'],
+ ['toast.cannotDeleteDayPlan', '无法删除:「{0}」正在被 {1} 使用。请先修改周映射。', 'Cannot delete: "{0}" is in use by {1}. Modify the week map first.'],
+ ['toast.invalidKeyFormat', 'key 仅支持英文、数字和下划线', 'Key: letters, digits and underscores only'],
+ ['toast.dayPlanExists', '日计划「{0}」已存在', 'Day plan "{0}" already exists'],
+ ['toast.platformExists', '平台 {0} 已存在!', 'Platform {0} already exists!'],
+ ['toast.dragYaml', '请拖入 YAML 文件', 'Please drag a YAML file'],
+ ['toast.dragTxt', '请拖入 TXT 文件', 'Please drag a TXT file'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Confirm / Alert Dialogs
+ // ═══════════════════════════════════════
+ add([
+ ['confirm.reset', '确定要重置为初始状态吗?未保存的修改将丢失。', 'Reset to initial state? Unsaved changes will be lost.'],
+ ['confirm.deletePlatform', '确定要删除平台 "{0}" 吗?', 'Delete platform "{0}"?'],
+ ['confirm.deleteRss', '确定要删除 RSS 源 "{0}" 吗?', 'Delete RSS feed "{0}"?'],
+ ['confirm.deletePeriod', '确定删除时间段「{0}」?', 'Delete period "{0}"?'],
+ ['confirm.periodInUse', '\n\n⚠️ 该时间段被以下日计划引用,将同时移除引用:\n', '\n\n⚠️ This period is referenced by the following day plans and will be removed:\n'],
+ ['confirm.deletePreset', '确定删除调度模式「{0}」?\n此操作不可撤销。', 'Delete schedule mode "{0}"?\nThis cannot be undone.'],
+ ['confirm.deleteDayPlan', '确定删除日计划「{0}」?', 'Delete day plan "{0}"?'],
+ ['confirm.updateFile', '确定要从 GitHub 更新 {0} 到最新版本吗?\n\n你当前的自定义配置将被覆盖,建议先复制保存。', 'Update {0} to latest from GitHub?\n\nYour custom config will be overwritten. Save a copy first.'],
+ ['alert.fillRequired', '请填写完整信息:ID、名称和 URL 都是必填项', 'Please fill in all required fields: ID, Name, and URL'],
+ ['alert.enterPlatformKey', '请输入平台 Key', 'Please enter platform key'],
+ ['alert.clickToAdd', '请直接点击上方列表中的平台进行添加', 'Click a platform in the list above to add it'],
+ ['prompt.enterDayPlanKey', '请输入日计划标识 (key),如 holiday:', 'Enter day plan key (e.g., holiday):'],
+ ['prompt.enterCoreKeyword', '请输入核心关键词(例如:华为):', 'Enter core keyword (e.g., Huawei):'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Load Config Modal
+ // ═══════════════════════════════════════
+ add([
+ ['loadModal.title', '加载官网最新配置', 'Load Latest Config'],
+ ['loadModal.desc', '选择要从 GitHub 加载的配置文件:', 'Select config files to load from GitHub:'],
+ ['loadModal.configDesc', '系统配置、平台、AI、通知等', 'System config, platforms, AI, notifications, etc.'],
+ ['loadModal.frequencyDesc', '关键词组、过滤规则、正则逻辑', 'Keyword groups, filter rules, regex logic'],
+ ['loadModal.timelineDesc', '调度时间线、预设模板、自定义时间段', 'Scheduling timeline, presets, custom periods'],
+ ['loadModal.source', '数据来源:', 'Data source: '],
+ ['loadModal.cancel', '取消', 'Cancel'],
+ ['loadModal.loadSelected', '加载选中', 'Load Selected'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Version Comparison Modal
+ // ═══════════════════════════════════════
+ add([
+ ['version.title', '版本检测结果', 'Version Check Result'],
+ ['version.noVersion', '未检测到版本信息', 'Version info not detected'],
+ ['version.newVersion', '发现新版本', 'New version available'],
+ ['version.devVersion', '当前版本较新(开发版本?)', 'Current version is newer (dev version?)'],
+ ['version.upToDate', '已是最新版本', 'Up to date'],
+ ['version.close', '关闭', 'Close'],
+ ['version.updateNow', '立即更新', 'Update Now'],
+ ['version.updateLater', '稍后更新', 'Update Later'],
+ ['version.updateToLatest', '更新到最新版本', 'Update to Latest'],
+ ['version.configFile', '配置文件', 'Config File'],
+ ['version.currentVersion', '当前版本', 'Current Version'],
+ ['version.latestVersion', '最新版本', 'Latest Version'],
+ ['version.unknown', '未知', 'Unknown'],
+ ['version.updateHint', '更新将从 GitHub 加载最新的 {0},你当前的修改将被覆盖。建议先复制保存你的自定义配置。', 'Update will load the latest {0} from GitHub. Your changes will be overwritten. Save a copy of your config first.'],
+ ['version.notFoundRemote', '未在远程版本清单中找到 {0}', '{0} not found in remote version list'],
+ ['version.fetchFailed', '版本信息获取失败: {0}', 'Failed to fetch version info: {0}'],
+ ['version.checking', '检测中...', 'Checking...'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // RSS Modal
+ // ═══════════════════════════════════════
+ add([
+ ['rssModal.addTitle', '添加 RSS 源', 'Add RSS Feed'],
+ ['rssModal.editTitle', '编辑 RSS 源', 'Edit RSS Feed'],
+ ['rssModal.idLabel', '源 ID(唯一标识,英文)', 'Feed ID (unique, alphanumeric)'],
+ ['rssModal.idPlaceholder', '例如: my-blog', 'e.g., my-blog'],
+ ['rssModal.nameLabel', '显示名称', 'Display Name'],
+ ['rssModal.namePlaceholder', '例如: 我的博客', 'e.g., My Blog'],
+ ['rssModal.urlLabel', 'RSS URL', 'RSS URL'],
+ ['rssModal.maxAgeLabel', '最大文章年龄(天,可选)', 'Max article age (days, optional)'],
+ ['rssModal.maxAgePlaceholder', '留空使用全局设置', 'Leave empty to use global setting'],
+ ['rssModal.tipsTitle', 'RSS 订阅灵感 & 参考库', 'RSS Inspiration & Reference Library'],
+ ['rssModal.tipsHasFeeds', '(内附常用源)', '(common feeds included)'],
+ ['rssModal.bingNews', 'Bing 新闻 (支持任意关键词)', 'Bing News (supports any keyword)'],
+ ['rssModal.bingTip', '小贴士:修改 URL 中的', 'Tip: Modify the'],
+ ['rssModal.bingTipSuffix', '参数即可监控任何你感兴趣的话题。', 'parameter to monitor any topic you like.'],
+ ['rssModal.moreRef', '更多 RSS 源参考', 'More RSS Feed References'],
+ ['rssModal.techProgramming', '科技/编程', 'Tech/Programming'],
+ ['rssModal.globalNews', '全球新闻', 'Global News'],
+ ['rssModal.ai', '人工智能', 'AI'],
+ ['rssModal.finance', '黄金/财经', 'Gold/Finance'],
+ ['rssModal.disclaimer', '免责声明:以上 RSS 示例及第三方工具均源自互联网,开发者未一一验证其长期有效性,请你在使用前自行核实。', 'Disclaimer: The RSS examples and third-party tools above are from the internet. The developer has not verified their long-term availability. Please verify before use.'],
+ ['rssModal.cancel', '取消', 'Cancel'],
+ ['rssModal.add', '添加', 'Add'],
+ ['rssModal.disabled', '已禁用', 'Disabled'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Platform Modal
+ // ═══════════════════════════════════════
+ add([
+ ['platModal.title', '添加热榜平台', 'Add Hot List Platform'],
+ ['platModal.selectPreset', '选择预设', 'Select Preset'],
+ ['platModal.manualInput', '手动输入', 'Manual Input'],
+ ['platModal.customNote', '自定义平台需要后端爬虫支持,此处仅用于配置占位。', 'Custom platforms require backend crawler support. This is for config placeholder only.'],
+ ['platModal.keyLabel', '平台 Key(英文)', 'Platform Key (alphanumeric)'],
+ ['platModal.keyPlaceholder', '例如: sspai', 'e.g., sspai'],
+ ['platModal.nameLabel', '显示名称', 'Display Name'],
+ ['platModal.namePlaceholder', '例如: 少数派', 'e.g., Sspai'],
+ ['platModal.allAdded', '所有预设平台已添加', 'All preset platforms added'],
+ ['platModal.cancel', '取消', 'Cancel'],
+ ['platModal.add', '添加', 'Add'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Word Group Type Modal
+ // ═══════════════════════════════════════
+ add([
+ ['wgModal.title', '选择词组类型', 'Select Word Group Type'],
+ ['wgModal.groupAlias', '组别名', 'Group Alias'],
+ ['wgModal.groupAliasDesc', '多关键词词组(推荐)', 'Multi-keyword group (recommended)'],
+ ['wgModal.groupAliasUse', '适用于:多个关键词归为一组,统一显示为组名', 'Use for: grouping multiple keywords under one display name'],
+ ['wgModal.singleAlias', '单个别名', 'Single Alias'],
+ ['wgModal.singleAliasDesc', '正则/关键词 + 别名', 'Regex/keyword + alias'],
+ ['wgModal.singleAliasUse', '适用于:用正则匹配多个词,显示为一个别名(前后有空行分隔)', 'Use for: matching multiple words via regex, displayed as one alias'],
+ ['wgModal.multiAlias', '连续别名组', 'Multi-alias Group'],
+ ['wgModal.multiAliasDesc', '多个相关品牌/词组', 'Multiple related brands/phrases'],
+ ['wgModal.multiAliasUse', '适用于:多个相关品牌放在一起(无空行分隔)', 'Use for: related brands together (no blank line separator)'],
+ ['wgModal.plain', '普通词组', 'Plain Keywords'],
+ ['wgModal.plainDesc', '简单关键词', 'Simple keywords'],
+ ['wgModal.plainUse', '适用于:单个或少量普通关键词', 'Use for: one or a few plain keywords'],
+ ['wgModal.cancel', '取消', 'Cancel'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Timeline Modals
+ // ═══════════════════════════════════════
+ add([
+ ['tlModal.newPreset', '新建调度模式', 'New Schedule Mode'],
+ ['tlModal.presetKeyLabel', '模式标识 (key)', 'Mode Key'],
+ ['tlModal.presetKeyPlaceholder', '英文标识,如 my_schedule', 'Alphanumeric key, e.g., my_schedule'],
+ ['tlModal.presetKeyHint', '仅支持英文、数字和下划线,将作为 YAML 中的 key', 'Letters, digits and underscores only, used as YAML key'],
+ ['tlModal.nameLabel', '显示名称', 'Display Name'],
+ ['tlModal.descLabel', '描述(可选)', 'Description (optional)'],
+ ['tlModal.templateLabel', '基于模板', 'Based on Template'],
+ ['tlModal.emptyTemplate', '空白模板(仅采集,不推送不分析)', 'Blank template (collect only, no push/analysis)'],
+ ['tlModal.templateHint', '复制已有模式的全部配置作为起点', 'Copy all config from an existing mode as starting point'],
+ ['tlModal.cancel', '取消', 'Cancel'],
+ ['tlModal.create', '创建', 'Create'],
+
+ ['tlModal.newPeriod', '新增时间段', 'New Period'],
+ ['tlModal.periodKeyLabel', '时间段标识 (key)', 'Period Key'],
+ ['tlModal.periodKeyPlaceholder', '英文标识,如 morning_push', 'Alphanumeric key, e.g., morning_push'],
+ ['tlModal.periodKeyHint', '仅支持英文、数字和下划线', 'Letters, digits and underscores only'],
+ ['tlModal.periodNamePlaceholder', '如:晨间推送', 'e.g., Morning Push'],
+ ['tlModal.startTime', '开始时间', 'Start Time'],
+ ['tlModal.endTime', '结束时间', 'End Time'],
+ ['tlModal.crossMidnight', '如果开始时间 > 结束时间(如 22:00~01:00),将自动识别为跨午夜时间段。', 'If start > end (e.g., 22:00–01:00), it will be treated as a cross-midnight period.'],
+ ['tlModal.add', '添加', 'Add'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Sidebar
+ // ═══════════════════════════════════════
+ add([
+ ['sidebar.title', '支持项目', 'Support'],
+ ['sidebar.quote', '若 TrendRadar 曾为你捕捉价值,不妨为它注入动力,助其持续进化', 'If TrendRadar has been valuable to you, help fuel its growth'],
+ ['sidebar.star', '点亮 Star', 'Star Us'],
+ ['sidebar.starDesc', '让更多人发现它', 'Help others discover it'],
+ ['sidebar.goGithub', '前往 GitHub', 'Go to GitHub'],
+ ['sidebar.follow', '不迷路', 'Stay Updated'],
+ ['sidebar.followDesc', '获取更新通知', 'Get update notifications'],
+ ['sidebar.scanFollow', '扫码关注公众号', 'Scan to follow on WeChat'],
+ ['sidebar.donate', '随心赞赏', 'Donate'],
+ ['sidebar.donateDesc', '1 元也是鼓励', 'Every bit helps'],
+ ['sidebar.scanDonate', '微信扫码 · 丰俭由人', 'WeChat scan · any amount'],
+ ['sidebar.explore', '探索更多', 'Explore More'],
+ ['sidebar.exploreDesc', '另一个用心的作品', 'Another well-crafted project'],
+ ['sidebar.goExplore', '去看看', 'Check it out'],
+ ['sidebar.footer', '"开源不易,感谢支持"', '"Open source isn\'t easy — thanks for your support"'],
+ ['sidebar.clickEnlarge', '点击放大', 'Click to enlarge'],
+ ['sidebar.expand', '展开侧栏', 'Expand sidebar'],
+ ['sidebar.collapse', '收起侧栏', 'Collapse sidebar'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // QR Modal
+ // ═══════════════════════════════════════
+ add([
+ ['qr.weixin.title', '不迷路', 'Stay Updated'],
+ ['qr.weixin.subtitle', '第一时间获取更新通知', 'Get notified of updates first'],
+ ['qr.weixin.hint', '微信扫码关注公众号', 'Scan to follow our WeChat account'],
+ ['qr.donate.title', '随心赞赏', 'Donate'],
+ ['qr.donate.subtitle', '金额随意,1 元也是鼓励 (´▽`ʃ♡ƪ)', 'Any amount is an encouragement (´▽`ʃ♡ƪ)'],
+ ['qr.donate.hint', '微信扫码 · 丰俭由人', 'WeChat scan · any amount'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Frequency Editor
+ // ═══════════════════════════════════════
+ add([
+ ['freq.typesTitle', '四种词组类型说明', 'Four Word Group Types'],
+ ['freq.groupAlias', '组别名', 'Group Alias'],
+ ['freq.groupAliasDesc', '多个关键词,统一显示为组名', 'Multiple keywords, displayed as group name'],
+ ['freq.singleAlias', '单个别名', 'Single Alias'],
+ ['freq.singleAliasDesc', '正则匹配,显示为别名', 'Regex match, displayed as alias'],
+ ['freq.multiAlias', '连续别名组', 'Multi-alias Group'],
+ ['freq.multiAliasDesc', '多个别名无空行分隔', 'Multiple aliases, no blank line separator'],
+ ['freq.plain', '普通词组', 'Plain Keywords'],
+ ['freq.plainDesc', '普通关键词', 'Plain keywords'],
+ ['freq.globalFilter', '全局过滤词', 'Global Filter'],
+ ['freq.globalFilterPlaceholder', '输入过滤词后按回车...', 'Enter a filter word, press Enter...'],
+ ['freq.regexHint', '支持正则表达式(用 /.../ 包裹)', 'Supports regex (wrap with /.../)'],
+ ['freq.keywordGroups', '关键词组', 'Keyword Groups'],
+ ['freq.nGroups', ' 个词组', ' groups'],
+ ['freq.addGroup', '添加词组', 'Add Group'],
+ ['freq.addGroupBottom', '在底部添加词组', 'Add group at bottom'],
+ ['freq.keywordList', '关键词列表:', 'Keyword list:'],
+ ['freq.keywordPlaceholder', '输入关键词后按回车...', 'Enter keyword, press Enter...'],
+ ['freq.nKeywords', ' 个关键词', ' keywords'],
+ ['freq.aiWriteRegex', 'AI 写正则', 'AI Generate Regex'],
+ ['freq.aliasList', '别名列表(无空行分隔):', 'Alias list (no blank line separator):'],
+ ['freq.aliasHint', '这些别名行在配置文件中无空行分隔,属于同一组', 'These alias lines have no blank line separator in the config and belong to the same group'],
+ ['freq.aliasExample', '示例:/胖东来|于东来/ => 胖东来', 'Example: /term1|term2/ => DisplayName'],
+ ['freq.relatedGroup', '相关组', 'Related'],
+ ['freq.required', '必须', 'Required'],
+ ['freq.exclude', '排除', 'Exclude'],
+ ['freq.limit', '限制', 'Limit'],
+ ['freq.regex', '正则', 'Regex'],
+ ['freq.alias', '别名', 'Alias'],
+ ['freq.groupNamePlaceholder', '组别名(如:东亚)', 'Group alias (e.g., East Asia)'],
+ ['freq.regexPlaceholder', '/正则/ 或 关键词', '/regex/ or keyword'],
+ ['freq.aliasPlaceholder', '别名', 'Alias'],
+ ['freq.noPlatforms', '暂无平台,请添加', 'No platforms yet'],
+ ['freq.noRssFeeds', '暂无 RSS 源,请添加', 'No RSS feeds yet'],
+ ['freq.noAvailPlatforms', '暂无可用平台', 'No platforms available'],
+ ['freq.noAvailRss', '暂无可用 RSS 源', 'No RSS feeds available'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Timeline Editor
+ // ═══════════════════════════════════════
+ add([
+ ['tl.scheduleMode', '调度模式', 'Schedule Mode'],
+ ['tl.weekView', '周视图', 'Week View'],
+ ['tl.recommend', '推荐', 'Recommended'],
+ ['tl.current', '当前', 'Active'],
+ ['tl.newMode', '新建模式', 'New Mode'],
+ ['tl.newModeDesc', '创建自定义调度方案', 'Create custom schedule'],
+ ['tl.presetNotFound', '未找到预设「{0}」的配置', 'Config for preset "{0}" not found'],
+ ['tl.pasteTimeline', '请在左侧粘贴 timeline.yaml 内容', 'Paste timeline.yaml content on the left'],
+ ['tl.orLoadConfig', '或点击右上角「加载官网最新配置」', 'Or click "Load Latest Config" at top right'],
+
+ ['tl.defaultConfig', '默认配置 (default)', 'Default Config'],
+ ['tl.defaultDesc', '不在任何时间段内时,使用以下配置:', 'Config used when outside any period:'],
+ ['tl.periods', '时间段 (Periods)', 'Periods'],
+ ['tl.addNew', '新增', 'Add'],
+ ['tl.noPeriods', '此模式无自定义时间段,全天使用 default 配置', 'No custom periods. Default config used all day.'],
+ ['tl.dayPlans', '日计划 (Day Plans)', 'Day Plans'],
+ ['tl.weekMap', '周映射 (Week Map)', 'Week Map'],
+ ['tl.overlapPolicy', '冲突策略 (Overlap)', 'Overlap Policy'],
+ ['tl.allWeekSame', '全周统一', 'All Week Same'],
+ ['tl.weekdaySame', '工作日统一', 'Weekdays Same'],
+ ['tl.weekdayWeekend', '工作日/周末', 'Weekday/Weekend'],
+
+ ['tl.legend.push', '推送', 'Push'],
+ ['tl.legend.analyze', 'AI 分析', 'AI Analysis'],
+ ['tl.legend.pushAnalyze', '推送 + 分析', 'Push + Analysis'],
+ ['tl.legend.collect', '仅采集', 'Collect Only'],
+ ['tl.legend.default', '默认 (default)', 'Default'],
+
+ ['tl.collect', '采集', 'Collect'],
+ ['tl.analyze', '分析', 'Analyze'],
+ ['tl.push', '推送', 'Push'],
+ ['tl.report', '报告:', 'Report:'],
+ ['tl.aiMode', 'AI:', 'AI:'],
+ ['tl.analyzeOnce', '仅分析一次', 'Analyze once'],
+ ['tl.pushOnce', '仅推送一次', 'Push once'],
+ ['tl.time', '时间:', 'Time:'],
+ ['tl.filterOverride', '筛选覆盖(可选)', 'Filter Override (optional)'],
+ ['tl.inherit', '继承', 'Inherit'],
+ ['tl.emptyDayPlan', '空 (全天走 default)', 'Empty (default all day)'],
+ ['tl.notSet', '(未设置)', '(not set)'],
+ ['tl.dayPlanLabel', '日计划:', 'Day plan:'],
+ ['tl.usesDefault', '使用 default 配置', 'Uses default config'],
+ ['tl.copy', '副本', 'Copy'],
+
+ ['tl.presetHint', '直接在上方调整开关和下拉框,左侧 YAML 会同步更新。如需更精细的控制,可直接编辑左侧 YAML 或修改 timeline.yaml。', 'Adjust toggles and dropdowns above — the YAML on the left updates in sync. For finer control, edit the YAML directly.'],
+ ['tl.customHint', '自定义模式支持完全自由编辑。可直接在上方调整控件,或在左侧编辑 YAML 文本,两边实时同步。', 'Custom mode supports full editing. Adjust controls above or edit YAML text on the left — both sync in real time.'],
+ ['tl.filterMethodHint.default', '不填则跟随全局 filter.method', 'Leave empty to follow global filter.method'],
+ ['tl.filterMethodHint.period', '不填则继承 default(再回退全局)', 'Leave empty to inherit from default (then fall back to global)'],
+ ['tl.filterFileHint', '。frequency_file 从 config/custom/keyword/ 查找,interests_file 从 config/custom/ai/ 查找;留空会删除该字段并恢复继承。', '. frequency_file resolves from config/custom/keyword/, interests_file from config/custom/ai/; empty removes the field and restores inheritance.'],
+ ['tl.overlapHint', 'error_on_overlap 会在时间段重叠时直接报错;last_wins 会按 day_plans 中靠后的时间段覆盖。', 'error_on_overlap raises an error on overlap; last_wins lets later periods in day_plans take precedence.'],
+ ['tl.errorOnOverlap', 'error_on_overlap(推荐)', 'error_on_overlap (recommended)'],
+ ['tl.lastWins', 'last_wins(后定义优先)', 'last_wins (last defined wins)'],
+ ['tl.addPeriod', '+ 添加', '+ Add'],
+ ['tl.custom', '自定义', 'Custom'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Day Names
+ // ═══════════════════════════════════════
+ add([
+ ['day.1', '周一', 'Mon'],
+ ['day.2', '周二', 'Tue'],
+ ['day.3', '周三', 'Wed'],
+ ['day.4', '周四', 'Thu'],
+ ['day.5', '周五', 'Fri'],
+ ['day.6', '周六', 'Sat'],
+ ['day.7', '周日', 'Sun'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Preset Platform Names
+ // ═══════════════════════════════════════
+ add([
+ ['plat.toutiao', '今日头条', 'Toutiao'],
+ ['plat.baidu', '百度热搜', 'Baidu Hot'],
+ ['plat.wallstreetcn-hot', '华尔街见闻', 'WallStreetCN'],
+ ['plat.thepaper', '澎湃新闻', 'The Paper'],
+ ['plat.bilibili-hot-search', 'bilibili 热搜', 'Bilibili Hot'],
+ ['plat.cls-hot', '财联社热门', 'CLS Hot'],
+ ['plat.ifeng', '凤凰网', 'iFeng'],
+ ['plat.tieba', '贴吧', 'Tieba'],
+ ['plat.weibo', '微博', 'Weibo'],
+ ['plat.douyin', '抖音', 'Douyin'],
+ ['plat.zhihu', '知乎', 'Zhihu'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Initial / Placeholder Text
+ // ═══════════════════════════════════════
+ add([
+ ['init.configPlaceholder', '# 在此粘贴你的 config.yaml...\n# 或拖拽文件到编辑器区域\n# 或点击右上角"加载官网最新配置"', '# Paste your config.yaml here...\n# Or drag a file into the editor\n# Or click "Load Latest Config" at top right'],
+ ['init.frequencyPlaceholder', '# 在此粘贴你的 frequency_words.txt 内容...\n# 或拖拽文件到编辑器区域\n\n[GLOBAL_FILTER]\n\n[WORD_GROUPS]\n', '# Paste your frequency_words.txt here...\n# Or drag a file into the editor\n\n[GLOBAL_FILTER]\n\n[WORD_GROUPS]\n'],
+ ['init.timelinePlaceholder', '# 在此粘贴你的 timeline.yaml...\n# 或拖拽文件到编辑器区域\n# 或点击右上角"加载官网最新配置"', '# Paste your timeline.yaml here...\n# Or drag a file into the editor\n# Or click "Load Latest Config" at top right'],
+ ['init.releaseToLoad', '释放以加载文件', 'Release to load file'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // Common / Misc
+ // ═══════════════════════════════════════
+ add([
+ ['common.cancel', '取消', 'Cancel'],
+ ['common.add', '添加', 'Add'],
+ ['common.delete', '删除', 'Delete'],
+ ['common.edit', '编辑', 'Edit'],
+ ['common.enable', '启用', 'Enable'],
+ ['common.disable', '禁用', 'Disable'],
+ ['common.close', '关闭', 'Close'],
+ ['common.copy', '复制', 'Copy'],
+ ['common.save', '保存', 'Save'],
+ ['common.hint', '提示:', 'Tip: '],
+ ['common.note', '注意:', 'Note: '],
+ ['common.warning', '注意:', 'Warning: '],
+ ['common.description', '说明:', 'Description: '],
+ ['common.jumpToEditor', '跳转到左侧编辑器', 'Jump to left editor'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // DeepSeek AI Prompt
+ // ═══════════════════════════════════════
+ add([
+ ['ai.promptCopied', '提示词已复制到剪贴板!', 'Prompt copied to clipboard!'],
+ ['ai.keyword', '关键词:', 'Keyword: '],
+ ['ai.goDeepSeek', '点击【确定】跳转 DeepSeek 官网,直接粘贴 (Ctrl+V) 即可。', 'Click OK to open DeepSeek and paste (Ctrl+V).'],
+ ['ai.copyFailed', '自动复制失败,请手动复制以下内容,然后自行打开 DeepSeek:', 'Auto-copy failed. Please copy the text below manually, then open DeepSeek:'],
+ ]);
+
+ // ═══════════════════════════════════════
+ // I18N Engine
+ // ═══════════════════════════════════════
+
+ window.t = function (key, replacements) {
+ var dict = T[currentLang] || T.zh;
+ var text = dict[key] || T.zh[key] || key;
+ if (replacements) {
+ if (typeof replacements === 'string') {
+ text = text.replace('{0}', replacements);
+ } else if (Array.isArray(replacements)) {
+ replacements.forEach(function (val, i) {
+ text = text.replace('{' + i + '}', val);
+ });
+ }
+ }
+ return text;
+ };
+
+ window.getLang = function () {
+ return currentLang;
+ };
+
+ window.switchLang = function (lang) {
+ if (lang !== 'zh' && lang !== 'en') return;
+ currentLang = lang;
+ localStorage.setItem(STORAGE_KEY_LANG, lang);
+ document.documentElement.lang = lang === 'zh' ? 'zh-CN' : 'en';
+ applyI18n();
+ updateLangToggleUI();
+ if (typeof renderModules === 'function') renderModules();
+ if (typeof syncYamlToUI === 'function') syncYamlToUI();
+ if (typeof switchTab === 'function') switchTab(typeof currentTab !== 'undefined' ? currentTab : 'config');
+ };
+
+ function applyI18n(root) {
+ var scope = root || document;
+ scope.querySelectorAll('[data-i18n]').forEach(function (el) {
+ var key = el.getAttribute('data-i18n');
+ var text = t(key);
+ if (text !== key) el.textContent = text;
+ });
+ scope.querySelectorAll('[data-i18n-html]').forEach(function (el) {
+ var key = el.getAttribute('data-i18n-html');
+ var text = t(key);
+ if (text !== key) el.innerHTML = text;
+ });
+ scope.querySelectorAll('[data-i18n-placeholder]').forEach(function (el) {
+ var key = el.getAttribute('data-i18n-placeholder');
+ var text = t(key);
+ if (text !== key) el.placeholder = text;
+ });
+ scope.querySelectorAll('[data-i18n-title]').forEach(function (el) {
+ var key = el.getAttribute('data-i18n-title');
+ var text = t(key);
+ if (text !== key) el.title = text;
+ });
+ }
+
+ window.applyI18n = applyI18n;
+
+ function updateLangToggleUI() {
+ var btn = document.getElementById('lang-toggle-btn');
+ var label = document.getElementById('lang-toggle-label');
+ if (btn) {
+ btn.title = currentLang === 'zh' ? 'Switch to English' : '切换到中文';
+ }
+ if (label) {
+ label.textContent = currentLang === 'zh' ? 'EN' : '中';
+ }
+ }
+
+ // Auto-init
+ (function init() {
+ var saved = localStorage.getItem(STORAGE_KEY_LANG);
+ if (saved === 'zh' || saved === 'en') {
+ currentLang = saved;
+ } else {
+ currentLang = (navigator.language || '').startsWith('zh') ? 'zh' : 'en';
+ }
+ document.documentElement.lang = currentLang === 'zh' ? 'zh-CN' : 'en';
+
+ if (document.readyState === 'loading') {
+ document.addEventListener('DOMContentLoaded', function () {
+ applyI18n();
+ updateLangToggleUI();
+ });
+ } else {
+ applyI18n();
+ updateLangToggleUI();
+ }
+ })();
+})();
diff --git a/docs/assets/script.js b/docs/assets/script.js
index 9baca30f83..f85f17a0e8 100644
--- a/docs/assets/script.js
+++ b/docs/assets/script.js
@@ -47,29 +47,31 @@ function syncScroll(textareaId, backdropId) {
// 12. 二维码放大弹窗逻辑
// ==========================================
-const QR_MODAL_DATA = {
- weixin: {
- icon: '<i class="fa-brands fa-weixin text-green-600"></i>',
- iconBg: 'bg-green-100',
- title: '不迷路',
- subtitle: '第一时间获取更新通知',
- img: './assets/weixin.webp',
- alt: '微信公众号',
- hint: '微信扫码关注公众号'
- },
- donate: {
- icon: '<i class="fa-solid fa-hand-holding-heart text-emerald-600"></i>',
- iconBg: 'bg-emerald-100',
- title: '随心赞赏',
- subtitle: '金额随意,1 元也是鼓励 (´▽`ʃ♡ƪ)',
- img: 'https://cdn-1258574687.cos.ap-shanghai.myqcloud.com/img/%2F2026%2F01%2F18ecce7c224ce0ea4c59394c29e408f8-e0d1db45.webp',
- alt: '微信支付',
- hint: '微信扫码 · 丰俭由人'
- }
-};
+function getQrModalData() {
+ return {
+ weixin: {
+ icon: '<i class="fa-brands fa-weixin text-green-600"></i>',
+ iconBg: 'bg-green-100',
+ title: t('qr.weixin.title'),
+ subtitle: t('qr.weixin.subtitle'),
+ img: './assets/weixin.webp',
+ alt: '微信公众号',
+ hint: t('qr.weixin.hint')
+ },
+ donate: {
+ icon: '<i class="fa-solid fa-hand-holding-heart text-emerald-600"></i>',
+ iconBg: 'bg-emerald-100',
+ title: t('qr.donate.title'),
+ subtitle: t('qr.donate.subtitle'),
+ img: 'https://cdn-1258574687.cos.ap-shanghai.myqcloud.com/img/%2F2026%2F01%2F18ecce7c224ce0ea4c59394c29e408f8-e0d1db45.webp',
+ alt: '微信支付',
+ hint: t('qr.donate.hint')
+ }
+ };
+}
function openQrModal(type) {
- const data = QR_MODAL_DATA[type];
+ const data = getQrModalData()[type];
if (!data) return;
const modal = document.getElementById('qr-modal');
document.getElementById('qr-modal-icon').className = 'w-10 h-10 rounded-xl flex items-center justify-center text-lg ' + data.iconBg;
@@ -90,22 +92,23 @@ function closeQrModal() {
window.openQrModal = openQrModal;
window.closeQrModal = closeQrModal;
const MODULE_DEFS = [
- { id: 1, name: "1. 基础设置", key: "app", editable: false },
- { id: 2, name: "2. 数据源 - 热榜平台", key: "platforms", editable: true },
- { id: 3, name: "3. 数据源 - RSS 订阅", key: "rss", editable: true },
- { id: 4, name: "4. 报告模式", key: "report", editable: true },
- { id: "4.5", name: "4.5 筛选策略", key: "filter", editable: true },
- { id: "4.6", name: "4.6 AI 智能筛选", key: "ai_filter", editable: true },
- { id: 5, name: "5. 推送内容控制", key: "display", editable: true },
- { id: 6, name: "6. 推送通知", key: "notification", editable: true, partial: true },
- { id: 7, name: "7. 存储配置", key: "storage", editable: false },
- { id: 8, name: "8. AI 模型配置", key: "ai", editable: true },
- { id: 9, name: "9. AI 分析功能", key: "ai_analysis", editable: true },
- { id: 10, name: "10. AI 翻译功能", key: "ai_translation", editable: true },
- { id: 11, name: "11. 高级设置", key: "advanced", editable: false }
+ { id: 1, nameKey: "mod.app", key: "app", editable: false },
+ { id: 2, nameKey: "mod.platforms", key: "platforms", editable: true },
+ { id: 3, nameKey: "mod.rss", key: "rss", editable: true },
+ { id: 4, nameKey: "mod.report", key: "report", editable: true },
+ { id: "4.5", nameKey: "mod.filter", key: "filter", editable: true },
+ { id: "4.6", nameKey: "mod.ai_filter", key: "ai_filter", editable: true },
+ { id: 5, nameKey: "mod.display", key: "display", editable: true },
+ { id: 6, nameKey: "mod.notification", key: "notification", editable: true, partial: true },
+ { id: 7, nameKey: "mod.storage", key: "storage", editable: false },
+ { id: 8, nameKey: "mod.ai", key: "ai", editable: true },
+ { id: 9, nameKey: "mod.ai_analysis", key: "ai_analysis", editable: true },
+ { id: 10, nameKey: "mod.ai_translation", key: "ai_translation", editable: true },
+ { id: 11, nameKey: "mod.advanced", key: "advanced", editable: false }
];
// 初始默认内容 (用于空状态) - 只显示提示文本
+function getInitialYaml() { return t('init.configPlaceholder'); }
const INITIAL_YAML = `# 在此粘贴你的 config.yaml...
# 或拖拽文件到编辑器区域
# 或点击右上角"加载官网最新配置"`;
@@ -120,11 +123,29 @@ const STORAGE_KEY_TIMELINE_TIME = 'trendradar_timeline_time';
// 官网配置文件 URL(GitHub 主源)
const GITHUB_RAW_BASE = 'https://raw.githubusercontent.com/sansan0/TrendRadar/refs/heads/master/';
-const REMOTE_CONFIG_URL = GITHUB_RAW_BASE + 'config/config.yaml';
-const REMOTE_FREQUENCY_URL = GITHUB_RAW_BASE + 'config/frequency_words.txt';
-const REMOTE_TIMELINE_URL = GITHUB_RAW_BASE + 'config/timeline.yaml';
const REMOTE_VERSION_URL = GITHUB_RAW_BASE + 'version_configs';
+// 远程配置文件路径随当前语言切换:中文用 config.yaml,英文用 config.en.yaml 等
+// 仅文件名不同,复用同一上游仓库与 CDN 回退源
+function remoteConfigPath(type) {
+ const en = (typeof getLang === 'function' && getLang() === 'en');
+ const suffix = en ? '.en' : '';
+ const names = {
+ config: 'config/config' + suffix + '.yaml',
+ frequency: 'config/frequency_words' + suffix + '.txt',
+ timeline: 'config/timeline' + suffix + '.yaml'
+ };
+ return names[type];
+}
+// 当前语言对应的完整远程配置 URL(供 fetchWithFallback 使用,须以 GITHUB_RAW_BASE 开头)
+function remoteConfigUrl(type) {
+ return GITHUB_RAW_BASE + remoteConfigPath(type);
+}
+// 当前语言对应的配置文件名(用于弹窗展示与提示,如 "config.yaml" / "config.en.yaml")
+function remoteConfigName(type) {
+ return remoteConfigPath(type).split('/').pop();
+}
+
// 所有源(GitHub 主源 + CDN 备用源),按优先级排列
const ALL_SOURCES = [
GITHUB_RAW_BASE,
@@ -165,7 +186,7 @@ async function fetchWithFallback(url, timeout = 5000) {
}
} catch {}
}
- throw new Error('所有源均不可用,请检查网络连接');
+ throw new Error(t('toast.allSourcesFailed'));
}
let currentYaml = "";
@@ -194,17 +215,18 @@ document.addEventListener('DOMContentLoaded', () => {
if (savedConfig && savedConfig.trim() && savedConfig !== INITIAL_YAML) {
yamlEditor.value = savedConfig;
currentYaml = savedConfig;
- showToast('已恢复上次保存的配置', 'info');
+ showToast(t('toast.configRestored'), 'info');
} else {
- yamlEditor.value = INITIAL_YAML;
- currentYaml = INITIAL_YAML;
+ const initYaml = getInitialYaml();
+ yamlEditor.value = initYaml;
+ currentYaml = initYaml;
}
if (savedFrequency && savedFrequency.trim()) {
frequencyEditor.value = savedFrequency;
currentFrequency = savedFrequency;
} else {
- frequencyEditor.value = "# 在此粘贴你的 frequency_words.txt 内容...\n# 或拖拽文件到编辑器区域\n\n[GLOBAL_FILTER]\n\n[WORD_GROUPS]\n";
+ frequencyEditor.value = t('init.frequencyPlaceholder');
currentFrequency = frequencyEditor.value;
}
@@ -212,7 +234,7 @@ document.addEventListener('DOMContentLoaded', () => {
const timelineEditor = document.getElementById('timeline-editor');
const savedTimeline = localStorage.getItem(STORAGE_KEY_TIMELINE);
- const INITIAL_TIMELINE = `# 在此粘贴你的 timeline.yaml...\n# 或拖拽文件到编辑器区域\n# 或点击右上角"加载官网最新配置"`;
+ const INITIAL_TIMELINE = t('init.timelinePlaceholder');
if (savedTimeline && savedTimeline.trim() && savedTimeline !== INITIAL_TIMELINE) {
timelineEditor.value = savedTimeline;
@@ -265,7 +287,7 @@ document.addEventListener('DOMContentLoaded', () => {
if ((e.ctrlKey || e.metaKey) && e.key === 's') {
e.preventDefault();
saveAllToLocalStorage();
- showToast('已手动保存配置', 'success');
+ showToast(t('toast.manualSave'), 'success');
}
});
@@ -313,7 +335,7 @@ function initDragAndDrop(editor, type) {
dropOverlay.innerHTML = `
<div class="drop-overlay-content">
<i class="fa-solid fa-cloud-arrow-up text-4xl mb-2"></i>
- <div class="text-sm font-bold">释放以加载文件</div>
+ <div class="text-sm font-bold">${t('init.releaseToLoad')}</div>
<div class="text-xs opacity-75">${type === 'config' ? 'config.yaml' : type === 'timeline' ? 'timeline.yaml' : 'frequency_words.txt'}</div>
</div>
`;
@@ -378,7 +400,7 @@ function handleFileDrop(e, type) {
const isValid = validExtensions.some(ext => fileName.endsWith(ext));
if (!isValid) {
- showToast(`请拖入 ${type === 'config' || type === 'timeline' ? 'YAML' : 'TXT'} 文件`, 'error');
+ showToast(type === 'config' || type === 'timeline' ? t('toast.dragYaml') : t('toast.dragTxt'), 'error');
return;
}
@@ -392,9 +414,9 @@ function handleFileDrop(e, type) {
document.getElementById('yaml-editor').value = content;
currentYaml = content;
syncYamlToUI();
- showToast(`已加载: ${file.name}`, 'success');
+ showToast(t('toast.loaded') + file.name, 'success');
} catch (err) {
- showToast(`YAML 语法错误: ${err.message}`, 'error');
+ showToast(t('toast.yamlError') + err.message, 'error');
// 仍然加载,让用户修复
document.getElementById('yaml-editor').value = content;
currentYaml = content;
@@ -406,9 +428,9 @@ function handleFileDrop(e, type) {
currentTimeline = content;
updateBackdrop('timeline-editor', 'timeline-backdrop');
syncTimelineToUI();
- showToast(`已加载: ${file.name}`, 'success');
+ showToast(t('toast.loaded') + file.name, 'success');
} catch (err) {
- showToast(`YAML 语法错误: ${err.message}`, 'error');
+ showToast(t('toast.yamlError') + err.message, 'error');
document.getElementById('timeline-editor').value = content;
currentTimeline = content;
}
@@ -416,12 +438,12 @@ function handleFileDrop(e, type) {
document.getElementById('frequency-editor').value = content;
currentFrequency = content;
syncFrequencyToUI();
- showToast(`已加载: ${file.name}`, 'success');
+ showToast(t('toast.loaded') + file.name, 'success');
}
};
reader.onerror = () => {
- showToast('文件读取失败', 'error');
+ showToast(t('toast.fileReadFail'), 'error');
};
reader.readAsText(file);
@@ -471,7 +493,7 @@ function saveToLocalStorage() {
// 格式化时间显示
function formatSaveTime(isoString) {
- if (!isoString) return '未保存';
+ if (!isoString) return t('save.notSaved');
const date = new Date(isoString);
const now = new Date();
const diffMs = now - date;
@@ -479,12 +501,12 @@ function formatSaveTime(isoString) {
const diffHours = Math.floor(diffMs / 3600000);
const diffDays = Math.floor(diffMs / 86400000);
- if (diffMins < 1) return '刚刚';
- if (diffMins < 60) return `${diffMins} 分钟前`;
- if (diffHours < 24) return `${diffHours} 小时前`;
- if (diffDays < 7) return `${diffDays} 天前`;
+ if (diffMins < 1) return t('time.justNow');
+ if (diffMins < 60) return diffMins + t('time.minutesAgo');
+ if (diffHours < 24) return diffHours + t('time.hoursAgo');
+ if (diffDays < 7) return diffDays + t('time.daysAgo');
- return date.toLocaleDateString('zh-CN', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
+ return date.toLocaleDateString(getLang() === 'zh' ? 'zh-CN' : 'en-US', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
}
// 更新保存时间显示
@@ -497,7 +519,7 @@ function updateSaveTimeDisplay() {
const configLabelEl = document.getElementById('config-save-label');
if (configTimeEl) {
configTimeEl.textContent = formatSaveTime(configTime);
- configTimeEl.title = configTime ? new Date(configTime).toLocaleString('zh-CN') : '未保存';
+ configTimeEl.title = configTime ? new Date(configTime).toLocaleString(getLang() === 'zh' ? 'zh-CN' : 'en-US') : t('save.notSaved');
if (configLabelEl) {
if (configTime) {
configLabelEl.classList.remove('hidden');
@@ -512,7 +534,7 @@ function updateSaveTimeDisplay() {
const frequencyLabelEl = document.getElementById('frequency-save-label');
if (frequencyTimeEl) {
frequencyTimeEl.textContent = formatSaveTime(frequencyTime);
- frequencyTimeEl.title = frequencyTime ? new Date(frequencyTime).toLocaleString('zh-CN') : '未保存';
+ frequencyTimeEl.title = frequencyTime ? new Date(frequencyTime).toLocaleString(getLang() === 'zh' ? 'zh-CN' : 'en-US') : t('save.notSaved');
if (frequencyLabelEl) {
if (frequencyTime) {
frequencyLabelEl.classList.remove('hidden');
@@ -528,7 +550,7 @@ function updateSaveTimeDisplay() {
const timelineLabelEl = document.getElementById('timeline-save-label');
if (timelineTimeEl) {
timelineTimeEl.textContent = formatSaveTime(timelineTime);
- timelineTimeEl.title = timelineTime ? new Date(timelineTime).toLocaleString('zh-CN') : '未保存';
+ timelineTimeEl.title = timelineTime ? new Date(timelineTime).toLocaleString(getLang() === 'zh' ? 'zh-CN' : 'en-US') : t('save.notSaved');
if (timelineLabelEl) {
if (timelineTime) {
timelineLabelEl.classList.remove('hidden');
@@ -550,46 +572,46 @@ window.openLoadConfigModal = function() {
modal.innerHTML = `
<div class="modal-content" style="max-width: 420px;">
<div class="flex items-center justify-between mb-4">
- <h3 class="text-lg font-bold text-gray-800"><i class="fa-solid fa-cloud-arrow-down mr-2 text-blue-500"></i>加载官网最新配置</h3>
+ <h3 class="text-lg font-bold text-gray-800"><i class="fa-solid fa-cloud-arrow-down mr-2 text-blue-500"></i>${t('loadModal.title')}</h3>
<button onclick="closeLoadConfigModal()" class="text-gray-400 hover:text-gray-600"><i class="fa-solid fa-times text-xl"></i></button>
</div>
<div class="text-sm text-gray-600 mb-4">
- 选择要从 GitHub 加载的配置文件:
+ ${t('loadModal.desc')}
</div>
<div class="space-y-3">
<label class="flex items-center gap-3 p-3 rounded-lg border border-gray-200 hover:bg-blue-50 hover:border-blue-300 cursor-pointer transition-colors">
<input type="checkbox" id="load-config-yaml" checked class="w-4 h-4 text-blue-600 rounded">
<div class="flex-1">
- <div class="font-medium text-gray-800">config.yaml</div>
- <div class="text-xs text-gray-500">系统配置、平台、AI、通知等</div>
+ <div class="font-medium text-gray-800">${remoteConfigName('config')}</div>
+ <div class="text-xs text-gray-500">${t('loadModal.configDesc')}</div>
</div>
<i class="fa-solid fa-file-code text-blue-400"></i>
</label>
<label class="flex items-center gap-3 p-3 rounded-lg border border-gray-200 hover:bg-blue-50 hover:border-blue-300 cursor-pointer transition-colors">
<input type="checkbox" id="load-frequency-txt" checked class="w-4 h-4 text-blue-600 rounded">
<div class="flex-1">
- <div class="font-medium text-gray-800">frequency_words.txt</div>
- <div class="text-xs text-gray-500">关键词组、过滤规则、正则逻辑</div>
+ <div class="font-medium text-gray-800">${remoteConfigName('frequency')}</div>
+ <div class="text-xs text-gray-500">${t('loadModal.frequencyDesc')}</div>
</div>
<i class="fa-solid fa-filter text-orange-400"></i>
</label>
<label class="flex items-center gap-3 p-3 rounded-lg border border-gray-200 hover:bg-blue-50 hover:border-blue-300 cursor-pointer transition-colors">
<input type="checkbox" id="load-timeline-yaml" checked class="w-4 h-4 text-blue-600 rounded">
<div class="flex-1">
- <div class="font-medium text-gray-800">timeline.yaml</div>
- <div class="text-xs text-gray-500">调度时间线、预设模板、自定义时间段</div>
+ <div class="font-medium text-gray-800">${remoteConfigName('timeline')}</div>
+ <div class="text-xs text-gray-500">${t('loadModal.timelineDesc')}</div>
</div>
<i class="fa-solid fa-calendar-week text-purple-400"></i>
</label>
</div>
<div class="text-xs text-gray-400 mt-3 p-2 bg-gray-50 rounded">
<i class="fa-solid fa-info-circle mr-1"></i>
- 数据来源:<a href="https://github.com/sansan0/TrendRadar" target="_blank" class="text-blue-500 hover:underline">sansan0/TrendRadar</a>
+ ${t('loadModal.source')}<a href="https://github.com/sansan0/TrendRadar" target="_blank" class="text-blue-500 hover:underline">sansan0/TrendRadar</a>
</div>
<div class="flex justify-end gap-2 mt-4">
- <button onclick="closeLoadConfigModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg">取消</button>
+ <button onclick="closeLoadConfigModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg">${t('loadModal.cancel')}</button>
<button onclick="confirmLoadConfig()" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700">
- <i class="fa-solid fa-download mr-1"></i>加载选中
+ <i class="fa-solid fa-download mr-1"></i>${t('loadModal.loadSelected')}
</button>
</div>
</div>
@@ -608,25 +630,24 @@ window.confirmLoadConfig = async function() {
const loadTimeline = document.getElementById('load-timeline-yaml')?.checked;
if (!loadConfig && !loadFrequency && !loadTimeline) {
- showToast('请至少选择一个文件', 'warning');
+ showToast(t('toast.selectOneFile'), 'warning');
return;
}
closeLoadConfigModal();
- showToast('正在加载最新配置...', 'info');
+ showToast(t('toast.loadingConfig'), 'info');
try {
const promises = [];
- if (loadConfig) promises.push(fetchWithFallback(REMOTE_CONFIG_URL).then(r => ({ type: 'config', res: r })));
- if (loadFrequency) promises.push(fetchWithFallback(REMOTE_FREQUENCY_URL).then(r => ({ type: 'frequency', res: r })));
- if (loadTimeline) promises.push(fetchWithFallback(REMOTE_TIMELINE_URL).then(r => ({ type: 'timeline', res: r })));
+ if (loadConfig) promises.push(fetchWithFallback(remoteConfigUrl('config')).then(r => ({ type: 'config', res: r })));
+ if (loadFrequency) promises.push(fetchWithFallback(remoteConfigUrl('frequency')).then(r => ({ type: 'frequency', res: r })));
+ if (loadTimeline) promises.push(fetchWithFallback(remoteConfigUrl('timeline')).then(r => ({ type: 'timeline', res: r })));
const results = await Promise.all(promises);
for (const { type, res } of results) {
if (!res.ok) {
- const names = { config: 'config.yaml', frequency: 'frequency_words.txt', timeline: 'timeline.yaml' };
- throw new Error(`${names[type]} 加载失败: ${res.status}`);
+ throw new Error(`${remoteConfigName(type)} ${t('toast.loadFailed')}${res.status}`);
}
const text = await res.text();
@@ -635,7 +656,7 @@ window.confirmLoadConfig = async function() {
try {
jsyaml.load(text);
} catch (yamlErr) {
- showToast(`YAML 语法错误: ${yamlErr.message}`, 'error');
+ showToast(t('toast.yamlError') + yamlErr.message, 'error');
continue;
}
document.getElementById('yaml-editor').value = text;
@@ -646,7 +667,7 @@ window.confirmLoadConfig = async function() {
try {
jsyaml.load(text);
} catch (yamlErr) {
- showToast(`YAML 语法错误: ${yamlErr.message}`, 'error');
+ showToast(t('toast.yamlError') + yamlErr.message, 'error');
continue;
}
document.getElementById('timeline-editor').value = text;
@@ -665,14 +686,14 @@ window.confirmLoadConfig = async function() {
saveToLocalStorage();
const loadedFiles = [];
- if (loadConfig) loadedFiles.push('config.yaml');
- if (loadFrequency) loadedFiles.push('frequency_words.txt');
- if (loadTimeline) loadedFiles.push('timeline.yaml');
- showToast(`已加载: ${loadedFiles.join(', ')}`, 'success');
+ if (loadConfig) loadedFiles.push(remoteConfigName('config'));
+ if (loadFrequency) loadedFiles.push(remoteConfigName('frequency'));
+ if (loadTimeline) loadedFiles.push(remoteConfigName('timeline'));
+ showToast(t('toast.loaded') + loadedFiles.join(', '), 'success');
} catch (err) {
console.error('加载远程配置失败:', err);
- showToast(`加载失败: ${err.message}`, 'error');
+ showToast(t('toast.loadFailed') + err.message, 'error');
}
}
@@ -730,11 +751,11 @@ function renderModules() {
const header = `
<div class="module-header px-4 py-3 flex items-center justify-between cursor-pointer" onclick="scrollToModuleInEditor('${mod.key}')">
<div class="flex items-center">
- <span class="text-sm font-bold">${mod.name}</span>
- <i class="fa-solid fa-arrow-up-right-from-square text-blue-400 text-[10px] ml-2 opacity-0 group-hover:opacity-100" title="跳转到左侧编辑器"></i>
+ <span class="text-sm font-bold">${t(mod.nameKey)}</span>
+ <i class="fa-solid fa-arrow-up-right-from-square text-blue-400 text-[10px] ml-2 opacity-0 group-hover:opacity-100" title="${t('common.jumpToEditor')}"></i>
</div>
${!mod.editable ?
- '<span class="locked-badge text-[10px] text-gray-400 border border-gray-200 px-1.5 py-0.5 rounded">只读 (请在左侧编辑)</span>' :
+ '<span class="locked-badge text-[10px] text-gray-400 border border-gray-200 px-1.5 py-0.5 rounded">' + t('panel.readOnly') + '</span>' :
'<i class="fa-solid fa-chevron-down text-gray-400 text-xs"></i>'}
</div>
`;
@@ -758,7 +779,7 @@ function renderModuleNav() {
nav.innerHTML = MODULE_DEFS.map(mod => `
<button onclick="scrollToModuleInEditor('${mod.key}')"
class="module-nav-btn text-[10px] px-2 py-1 rounded ${mod.editable ? 'bg-blue-100 text-blue-700 hover:bg-blue-200' : 'bg-gray-100 text-gray-500 hover:bg-gray-200'} transition-colors"
- title="跳转到模块 ${mod.id}">
+ title="${t(mod.nameKey)}">
${mod.id}
</button>
`).join('');
@@ -885,92 +906,92 @@ function renderControls(mod) {
switch(mod.key) {
case "platforms":
- html = createToggleControl(mod.key, "enabled", "启用热榜抓取");
- html += `<div class="mt-4 mb-2 text-xs font-bold text-gray-700">平台列表 <span class="text-gray-400 font-normal">(可拖拽排序)</span></div>`;
+ html = createToggleControl(mod.key, "enabled", t('ctrl.enableHotlist'));
+ html += `<div class="mt-4 mb-2 text-xs font-bold text-gray-700">${t('ctrl.platformList')} <span class="text-gray-400 font-normal">(${t('ctrl.dragToSort')})</span></div>`;
html += `<div id="platforms-list" class="space-y-2"></div>`;
html += `<div class="flex items-center gap-2 mt-3">
<button onclick="openPlatformModal()" class="text-xs bg-green-600 text-white px-3 py-1.5 rounded hover:bg-green-700 transition-colors">
- <i class="fa-solid fa-plus mr-1"></i>添加平台
+ <i class="fa-solid fa-plus mr-1"></i>${t('ctrl.addPlatform')}
</button>
<a href="https://github.com/sansan0/TrendRadar?tab=readme-ov-file#%E9%85%8D%E7%BD%AE%E8%AF%A6%E8%A7%A3" target="_blank" class="text-xs bg-gray-100 text-gray-600 px-3 py-1.5 rounded hover:bg-gray-200 transition-colors border border-gray-200 flex items-center gap-1 no-underline">
- <i class="fa-solid fa-circle-question text-gray-400"></i>添加其它平台
+ <i class="fa-solid fa-circle-question text-gray-400"></i>${t('ctrl.addOtherPlatform')}
</a>
</div>`;
break;
case "rss":
- html = createToggleControl(mod.key, "enabled", "启用 RSS 抓取");
- html += `<div class="mt-3 mb-2 text-xs font-bold text-gray-700">新鲜度过滤</div>`;
- html += createToggleControl(mod.key, "freshness_filter.enabled", "启用新鲜度过滤");
- html += createNumberControl(mod.key, "freshness_filter.max_age_days", "最大文章年龄 (天)");
- html += `<div class="mt-4 mb-2 text-xs font-bold text-gray-700">RSS 源列表</div>`;
+ html = createToggleControl(mod.key, "enabled", t('ctrl.enableRss'));
+ html += `<div class="mt-3 mb-2 text-xs font-bold text-gray-700">${t('ctrl.freshnessFilter')}</div>`;
+ html += createToggleControl(mod.key, "freshness_filter.enabled", t('ctrl.enableFreshness'));
+ html += createNumberControl(mod.key, "freshness_filter.max_age_days", t('ctrl.maxAgeDays'));
+ html += `<div class="mt-4 mb-2 text-xs font-bold text-gray-700">${t('ctrl.rssFeedList')}</div>`;
html += `<div id="rss-feeds-list" class="space-y-2"></div>`;
html += `<div class="flex items-center gap-2 mt-3">
<button onclick="openRssModal()" class="text-xs bg-green-600 text-white px-3 py-1.5 rounded hover:bg-green-700 transition-colors">
- <i class="fa-solid fa-plus mr-1"></i>添加 RSS 源
+ <i class="fa-solid fa-plus mr-1"></i>${t('ctrl.addRss')}
</button>
<div class="text-xs text-gray-500 italic">
- (内附 RSS 源参考库)
+ ${t('ctrl.rssLibHint')}
</div>
</div>`;
html += `<div class="text-xs text-orange-600 mt-2 p-2 bg-orange-50 rounded border border-orange-200">
<i class="fa-solid fa-triangle-exclamation mr-1"></i>
- <strong>注意:</strong>部分海外媒体内容可能涉及敏感话题,AI 模型可能拒绝翻译或分析,建议根据实际需求筛选订阅源。
+ <strong>${t('common.warning')}</strong>${t('ctrl.rssWarning')}
</div>`;
break;
case "report":
- html = createSelectControl(mod.key, "mode", "报告模式", ["current", "daily", "incremental"]);
- html += createSelectControl(mod.key, "display_mode", "分组维度", ["keyword", "platform"]);
- html += createToggleControl(mod.key, "sort_by_position_first", "按定义顺序排序");
- html += createNumberControl(mod.key, "rank_threshold", "排名高亮阈值");
- html += createNumberControl(mod.key, "max_news_per_keyword", "每个关键词最大显示数量");
+ html = createSelectControl(mod.key, "mode", t('ctrl.reportMode'), ["current", "daily", "incremental"]);
+ html += createSelectControl(mod.key, "display_mode", t('ctrl.displayMode'), ["keyword", "platform"]);
+ html += createToggleControl(mod.key, "sort_by_position_first", t('ctrl.sortByPosition'));
+ html += createNumberControl(mod.key, "rank_threshold", t('ctrl.rankThreshold'));
+ html += createNumberControl(mod.key, "max_news_per_keyword", t('ctrl.maxNewsPerKeyword'));
break;
case "filter":
- html = createSelectControl(mod.key, "method", "筛选方法", ["keyword", "ai"]);
- html += createToggleControl(mod.key, "priority_sort_enabled", "AI 模式按标签优先级排序");
+ html = createSelectControl(mod.key, "method", t('ctrl.filterMethod'), ["keyword", "ai"]);
+ html += createToggleControl(mod.key, "priority_sort_enabled", t('ctrl.prioritySort'));
html += `<div class="text-xs text-gray-500 mt-2 p-2 bg-blue-50 rounded border border-blue-200">
<i class="fa-solid fa-info-circle mr-1 text-blue-500"></i>
- <strong>说明:</strong><code>method=keyword</code> 使用 <code>frequency_words.txt</code>;
- <code>method=ai</code> 使用 <code>ai_interests.txt</code> + AI 筛选配置。<br>
- <code>priority_sort_enabled</code> 仅在 <code>method=ai</code> 时生效。
+ <strong>${t('common.description')}</strong><code>method=keyword</code> ${t('ctrl.filterNote')} <code>frequency_words.txt</code>;
+ <code>method=ai</code> ${t('ctrl.filterNote')} <code>ai_interests.txt</code> + AI filter config.<br>
+ <code>priority_sort_enabled</code> ${t('ctrl.aiFilterNote')}
</div>`;
break;
case "ai_filter":
html = `<div class="text-xs text-gray-500 mb-3 p-2 bg-blue-50 rounded border border-blue-200">
<i class="fa-solid fa-info-circle mr-1 text-blue-500"></i>
- 仅当 <strong>filter.method=ai</strong> 时生效。
+ ${t('ctrl.aiFilterNote')}
</div>`;
- html += createNumberControl(mod.key, "batch_size", "每批标题数量");
- html += createNumberControl(mod.key, "batch_interval", "分批间隔 (秒)");
- html += createNumberControl(mod.key, "min_score", "最低分数阈值 (0~1)");
- html += createInputControl(mod.key, "interests_file", "兴趣描述文件 (可选)");
+ html += createNumberControl(mod.key, "batch_size", t('ctrl.batchSize'));
+ html += createNumberControl(mod.key, "batch_interval", t('ctrl.batchInterval'));
+ html += createNumberControl(mod.key, "min_score", t('ctrl.minScore'));
+ html += createInputControl(mod.key, "interests_file", t('ctrl.interestsFile'));
html += `<div class="text-xs text-amber-700 mt-1 mb-3 p-2 bg-amber-50 rounded border border-amber-200">
<i class="fa-solid fa-folder-tree mr-1"></i>
- 留空时使用 <code>config/ai_interests.txt</code>;填写后仅从
- <code>config/custom/ai/</code> 查找该文件名。
+ ${t('ctrl.interestsFileHint')} <code>config/ai_interests.txt</code>;
+ <code>config/custom/ai/</code>
</div>`;
- html += createNumberControl(mod.key, "reclassify_threshold", "全量重分类阈值 (0~1)");
- html += createInputControl(mod.key, "prompt_file", "分类提示词文件");
- html += createInputControl(mod.key, "extract_prompt_file", "标签提取提示词文件");
- html += createInputControl(mod.key, "update_tags_prompt_file", "标签更新提示词文件");
+ html += createNumberControl(mod.key, "reclassify_threshold", t('ctrl.reclassifyThreshold'));
+ html += createInputControl(mod.key, "prompt_file", t('ctrl.promptFile'));
+ html += createInputControl(mod.key, "extract_prompt_file", t('ctrl.extractPromptFile'));
+ html += createInputControl(mod.key, "update_tags_prompt_file", t('ctrl.updateTagsPromptFile'));
break;
case "display":
- html = `<div class="text-xs font-bold text-gray-700 mb-2">推送内容控制 <span class="text-gray-400 font-normal">(可拖拽排序)</span></div>`;
+ html = `<div class="text-xs font-bold text-gray-700 mb-2">${t('ctrl.pushContentControl')} <span class="text-gray-400 font-normal">(${t('ctrl.dragToSort')})</span></div>`;
html += `<div id="display-regions-list" class="space-y-2"></div>`;
html += `<div class="text-xs text-gray-500 mt-2 mb-6">
<i class="fa-solid fa-lightbulb mr-1"></i>
- 提示:列表顺序决定了报告中的显示顺序
+ ${t('common.hint')}${t('ctrl.displayOrderHint')}
</div>`;
// Standalone Configuration Section
html += `<div class="border-t border-gray-200 pt-4 mt-4">`;
- html += `<div class="text-xs font-bold text-gray-700 mb-3">独立展示区配置 <span class="text-gray-400 font-normal">(推送展示由上方开关控制,AI 分析由 AI 模块的开关独立控制)</span></div>`;
+ html += `<div class="text-xs font-bold text-gray-700 mb-3">${t('ctrl.standaloneConfig')} <span class="text-gray-400 font-normal">(${t('ctrl.standaloneNote')})</span></div>`;
- html += createNumberControl(mod.key, "standalone.max_items", "每个源最多展示条数");
+ html += createNumberControl(mod.key, "standalone.max_items", t('ctrl.maxStandaloneItems'));
- html += `<div class="mt-3 mb-2 text-xs font-medium text-gray-700">选择要展示的热榜平台</div>`;
+ html += `<div class="mt-3 mb-2 text-xs font-medium text-gray-700">${t('ctrl.selectPlatforms')}</div>`;
html += `<div id="standalone-platforms-list" class="max-h-40 overflow-y-auto border border-gray-200 rounded p-2 bg-gray-50 grid grid-cols-2 gap-2"></div>`;
- html += `<div class="mt-3 mb-2 text-xs font-medium text-gray-700">选择要展示的 RSS 源</div>`;
+ html += `<div class="mt-3 mb-2 text-xs font-medium text-gray-700">${t('ctrl.selectRssFeeds')}</div>`;
html += `<div id="standalone-rss-list" class="max-h-40 overflow-y-auto border border-gray-200 rounded p-2 bg-gray-50 grid grid-cols-1 gap-2"></div>`;
html += `</div>`;
@@ -983,43 +1004,42 @@ function renderControls(mod) {
case "notification":
html = `<div class="text-xs text-gray-500 mb-2 p-2 bg-blue-50 rounded border border-blue-200">
<i class="fa-solid fa-info-circle mr-1 text-blue-500"></i>
- 推送时间由 <strong>timeline.yaml</strong> 控制,切换到 timeline.yaml 标签页可可视化编辑调度规则。<br>
- 此处仅配置通知渠道(Telegram / 企业微信等),请在左侧编辑器中修改。
+ ${t('ctrl.notificationNote')}
</div>`;
break;
case "ai":
- html = createInputControl(mod.key, "model", "模型名称");
- html += createInputControl(mod.key, "api_key", "API Key", "password");
- html += createInputControl(mod.key, "api_base", "API Base URL (可选)");
- html += createNumberControl(mod.key, "timeout", "请求超时 (秒)");
- html += createNumberControl(mod.key, "temperature", "采样温度 (0.0-2.0)");
- html += createNumberControl(mod.key, "max_tokens", "最大生成 Token 数");
+ html = createInputControl(mod.key, "model", t('ctrl.modelName'));
+ html += createInputControl(mod.key, "api_key", t('ctrl.apiKey'), "password");
+ html += createInputControl(mod.key, "api_base", t('ctrl.apiBase'));
+ html += createNumberControl(mod.key, "timeout", t('ctrl.timeout'));
+ html += createNumberControl(mod.key, "temperature", t('ctrl.temperature'));
+ html += createNumberControl(mod.key, "max_tokens", t('ctrl.maxTokens'));
break;
case "ai_analysis":
- html = createToggleControl(mod.key, "enabled", "开启 AI 分析报告");
+ html = createToggleControl(mod.key, "enabled", t('ctrl.enableAnalysis'));
// 提示:分析时间窗口已迁移到 timeline.yaml
html += `<div class="text-xs text-gray-500 mt-3 mb-3 p-2 bg-blue-50 rounded border border-blue-200">
<i class="fa-solid fa-info-circle mr-1 text-blue-500"></i>
- AI 分析的执行时间已由 <strong>timeline.yaml</strong> 统一控制。
+ ${t('ctrl.analysisTimeNote')}
</div>`;
// 其他 AI 分析配置
- html += `<div class="text-xs font-bold text-blue-600 mb-2">分析内容配置</div>`;
- html += createInputControl(mod.key, "language", "输出语言");
- html += createInputControl(mod.key, "prompt_file", "提示词配置文件");
- html += createSelectControl(mod.key, "mode", "AI 分析模式", ["follow_report", "daily", "current", "incremental"]);
- html += createNumberControl(mod.key, "max_news_for_analysis", "最大分析条数");
- html += createToggleControl(mod.key, "include_rss", "包含 RSS 内容");
- html += createToggleControl(mod.key, "include_standalone", "包含独立展示区数据");
- html += createToggleControl(mod.key, "include_rank_timeline", "传递完整排名时间线");
+ html += `<div class="text-xs font-bold text-blue-600 mb-2">${t('ctrl.analysisContentConfig')}</div>`;
+ html += createInputControl(mod.key, "language", t('ctrl.outputLanguage'));
+ html += createInputControl(mod.key, "prompt_file", t('ctrl.promptConfigFile'));
+ html += createSelectControl(mod.key, "mode", t('ctrl.aiAnalysisMode'), ["follow_report", "daily", "current", "incremental"]);
+ html += createNumberControl(mod.key, "max_news_for_analysis", t('ctrl.maxNewsForAnalysis'));
+ html += createToggleControl(mod.key, "include_rss", t('ctrl.includeRss'));
+ html += createToggleControl(mod.key, "include_standalone", t('ctrl.includeStandalone'));
+ html += createToggleControl(mod.key, "include_rank_timeline", t('ctrl.includeRankTimeline'));
break;
case "ai_translation":
- html = createToggleControl(mod.key, "enabled", "开启 AI 自动翻译");
- html += createInputControl(mod.key, "language", "目标语言");
- html += createInputControl(mod.key, "prompt_file", "提示词配置文件");
- html += createNumberControl(mod.key, "batch_size", "每批翻译标题数");
- html += createNumberControl(mod.key, "batch_interval", "分批间隔 (秒)");
+ html = createToggleControl(mod.key, "enabled", t('ctrl.enableTranslation'));
+ html += createInputControl(mod.key, "language", t('ctrl.targetLanguage'));
+ html += createInputControl(mod.key, "prompt_file", t('ctrl.promptConfigFile'));
+ html += createNumberControl(mod.key, "batch_size", t('ctrl.translationBatchSize'));
+ html += createNumberControl(mod.key, "batch_interval", t('ctrl.batchInterval'));
break;
}
@@ -1223,7 +1243,7 @@ function createInputControl(mod, path, label, type = "text") {
return `
<div>
<label class="block text-[10px] uppercase tracking-wider font-bold text-gray-400 mb-1">${label}</label>
- <input type="${type}" data-path="${path}" class="bg-white border-gray-300 focus:border-blue-500" placeholder="未设置">
+ <input type="${type}" data-path="${path}" class="bg-white border-gray-300 focus:border-blue-500" placeholder="${t('tl.notSet')}">
</div>
`;
}
@@ -1265,28 +1285,29 @@ window.copyResult = function() {
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(text).then(() => {
- btn.innerHTML = '<i class="fa-solid fa-check mr-1.5"></i>已复制!';
+ btn.innerHTML = '<i class="fa-solid fa-check mr-1.5"></i>' + t('nav.copied');
setTimeout(() => btn.innerHTML = original, 2000);
}).catch(() => {
editor.select();
document.execCommand('copy');
- btn.innerHTML = '<i class="fa-solid fa-check mr-1.5"></i>已复制!';
+ btn.innerHTML = '<i class="fa-solid fa-check mr-1.5"></i>' + t('nav.copied');
setTimeout(() => btn.innerHTML = original, 2000);
});
} else {
editor.select();
document.execCommand('copy');
- btn.innerHTML = '<i class="fa-solid fa-check mr-1.5"></i>已复制!';
+ btn.innerHTML = '<i class="fa-solid fa-check mr-1.5"></i>' + t('nav.copied');
setTimeout(() => btn.innerHTML = original, 2000);
}
}
window.resetToDefault = function() {
- if (confirm('确定要重置为初始状态吗?未保存的修改将丢失。')) {
+ if (confirm(t('confirm.reset'))) {
if (currentTab === 'config') {
const yamlEditor = document.getElementById('yaml-editor');
- yamlEditor.value = INITIAL_YAML;
- currentYaml = INITIAL_YAML;
+ const initYaml = getInitialYaml();
+ yamlEditor.value = initYaml;
+ currentYaml = initYaml;
updateBackdrop('yaml-editor', 'yaml-backdrop');
localStorage.removeItem(STORAGE_KEY_CONFIG);
localStorage.removeItem(STORAGE_KEY_CONFIG_TIME);
@@ -1295,7 +1316,7 @@ window.resetToDefault = function() {
updateSaveTimeDisplay();
} else if (currentTab === 'timeline') {
const timelineEditor = document.getElementById('timeline-editor');
- const initialTimeline = `# 在此粘贴你的 timeline.yaml...\n# 或拖拽文件到编辑器区域\n# 或点击右上角"加载官网最新配置"`;
+ const initialTimeline = t('init.timelinePlaceholder');
timelineEditor.value = initialTimeline;
currentTimeline = initialTimeline;
updateBackdrop('timeline-editor', 'timeline-backdrop');
@@ -1305,7 +1326,7 @@ window.resetToDefault = function() {
updateSaveTimeDisplay();
} else {
const frequencyEditor = document.getElementById('frequency-editor');
- frequencyEditor.value = "# 在此粘贴你的 frequency_words.txt 内容...\n\n[GLOBAL_FILTER]\n\n[WORD_GROUPS]\n";
+ frequencyEditor.value = t('init.frequencyPlaceholder');
currentFrequency = frequencyEditor.value;
updateBackdrop('frequency-editor', 'frequency-backdrop');
localStorage.removeItem(STORAGE_KEY_FREQUENCY);
@@ -1313,7 +1334,7 @@ window.resetToDefault = function() {
syncFrequencyToUI();
updateSaveTimeDisplay();
}
- showToast('已重置为初始状态', 'success');
+ showToast(t('toast.resetDone'), 'success');
}
}
@@ -1362,13 +1383,13 @@ window.switchTab = function(tab) {
// 更新右侧标题
const versionBtn = document.getElementById('version-check-btn');
if (tab === 'config') {
- document.getElementById('right-panel-title').textContent = '配置模块';
- if (versionBtn) { versionBtn.style.display = ''; versionBtn.title = "检测 config.yaml 版本"; }
+ document.getElementById('right-panel-title').textContent = t('panel.configModules');
+ if (versionBtn) { versionBtn.style.display = ''; versionBtn.title = t('panel.versionCheck') + " config.yaml"; }
} else if (tab === 'frequency') {
- document.getElementById('right-panel-title').textContent = '频率词编辑';
- if (versionBtn) { versionBtn.style.display = ''; versionBtn.title = "检测 frequency_words.txt 版本"; }
+ document.getElementById('right-panel-title').textContent = t('panel.frequencyEdit');
+ if (versionBtn) { versionBtn.style.display = ''; versionBtn.title = t('panel.versionCheck') + " frequency_words.txt"; }
} else {
- document.getElementById('right-panel-title').textContent = '时间线调度';
+ document.getElementById('right-panel-title').textContent = t('panel.timelineSchedule');
if (versionBtn) versionBtn.style.display = 'none';
}
@@ -1733,25 +1754,25 @@ function renderFrequencyPanel(data) {
// 辅助函数:为关键词添加标签
function getKeywordLabel(keyword) {
- if (keyword.startsWith('+')) return '必须';
- if (keyword.startsWith('!')) return '排除';
- if (keyword.startsWith('@')) return '限制';
- if (keyword.startsWith('/')) return '正则';
- if (keyword.includes('=>')) return '别名';
+ if (keyword.startsWith('+')) return t('freq.required');
+ if (keyword.startsWith('!')) return t('freq.exclude');
+ if (keyword.startsWith('@')) return t('freq.limit');
+ if (keyword.startsWith('/')) return t('freq.regex');
+ if (keyword.includes('=>')) return t('freq.alias');
return '';
}
// 渲染词组卡片
function renderGroupCard(group, idx) {
- const jumpIcon = `<i class="fa-solid fa-grip-vertical text-gray-400 text-xs mr-2" title="拖动调整顺序"></i>`;
+ const jumpIcon = `<i class="fa-solid fa-grip-vertical text-gray-400 text-xs mr-2"></i>`;
// 序号标记
- const indexBadge = `<span class="text-xs bg-gray-700 text-white px-2.5 py-1 rounded-full font-bold mr-2" title="词组序号">#${idx + 1}</span>`;
+ const indexBadge = `<span class="text-xs bg-gray-700 text-white px-2.5 py-1 rounded-full font-bold mr-2">#${idx + 1}</span>`;
// 相关组标记
const relatedGroupBadge = group.isRelatedGroup
- ? `<span class="text-[10px] bg-gradient-to-r from-blue-500 to-indigo-500 text-white px-2 py-0.5 rounded font-bold ml-2" title="此组与相邻组相关(无空行分隔)">
- <i class="fa-solid fa-link mr-1"></i>相关组 ${group.relatedGroupIndex + 1}/${group.relatedGroupTotal}
+ ? `<span class="text-[10px] bg-gradient-to-r from-blue-500 to-indigo-500 text-white px-2 py-0.5 rounded font-bold ml-2">
+ <i class="fa-solid fa-link mr-1"></i>${t('freq.relatedGroup')} ${group.relatedGroupIndex + 1}/${group.relatedGroupTotal}
</span>`
: '';
@@ -1768,9 +1789,9 @@ function renderFrequencyPanel(data) {
<div class="flex items-center flex-1 gap-2">
${jumpIcon}
${indexBadge}
- <span class="text-[10px] bg-orange-500 text-white px-2 py-0.5 rounded font-bold">组别名</span>
+ <span class="text-[10px] bg-orange-500 text-white px-2 py-0.5 rounded font-bold">${t('wgModal.groupAlias')}</span>
${relatedGroupBadge}
- <input type="text" value="${group.name || ''}" placeholder="组别名(如:东亚)"
+ <input type="text" value="${group.name || ''}" placeholder="${t('freq.groupNamePlaceholder')}"
class="text-sm font-bold border-0 border-b-2 border-orange-300 focus:border-orange-500 outline-none px-2 py-1 flex-1 bg-transparent"
onclick="event.stopPropagation()"
onchange="updateGroupName(${idx}, this.value)">
@@ -1780,7 +1801,7 @@ function renderFrequencyPanel(data) {
</button>
</div>
<div class="bg-white rounded p-3 border border-orange-200 editable-area" onclick="event.stopPropagation()">
- <div class="text-xs text-gray-600 mb-2 font-bold">关键词列表:</div>
+ <div class="text-xs text-gray-600 mb-2 font-bold">${t('freq.keywordList')}</div>
<div class="tag-input-container">
${group.keywords.map(kw => {
const label = getKeywordLabel(kw);
@@ -1793,14 +1814,14 @@ function renderFrequencyPanel(data) {
</span>
`;
}).join('')}
- <input type="text" class="tag-input" placeholder="输入关键词后按回车..."
+ <input type="text" class="tag-input" placeholder="${t('freq.keywordPlaceholder')}"
onkeydown="handleKeywordInput(event, ${idx})">
</div>
<div class="flex items-center justify-between mt-2">
<button onclick="openDeepSeekAI('group', ${idx})" class="text-xs text-blue-600 hover:text-blue-700 flex items-center gap-1">
- <i class="fa-solid fa-wand-magic-sparkles"></i>AI 写正则
+ <i class="fa-solid fa-wand-magic-sparkles"></i>${t('freq.aiWriteRegex')}
</button>
- <div class="text-[10px] text-gray-400">${group.keywords.length} 个关键词</div>
+ <div class="text-[10px] text-gray-400">${group.keywords.length}${t('freq.nKeywords')}</div>
</div>
</div>
</div>
@@ -1814,7 +1835,7 @@ function renderFrequencyPanel(data) {
<div class="flex items-center flex-1 gap-2">
${jumpIcon}
${indexBadge}
- <span class="text-[10px] bg-teal-500 text-white px-2 py-0.5 rounded font-bold">单个别名</span>
+ <span class="text-[10px] bg-teal-500 text-white px-2 py-0.5 rounded font-bold">${t('wgModal.singleAlias')}</span>
${relatedGroupBadge}
</div>
<button onclick="event.stopPropagation(); removeWordGroup(${idx})" class="text-red-500 hover:text-red-700 text-xs">
@@ -1823,20 +1844,20 @@ function renderFrequencyPanel(data) {
</div>
<div class="bg-white rounded p-3 border border-teal-200 editable-area" onclick="event.stopPropagation()">
<div class="flex items-center gap-2">
- <input type="text" value="${item.keyword || ''}" placeholder="/正则/ 或 关键词"
+ <input type="text" value="${item.keyword || ''}" placeholder="${t('freq.regexPlaceholder')}"
class="flex-1 px-3 py-2 border border-gray-300 rounded focus:border-teal-500 outline-none text-sm font-mono"
onblur="updateAliasItem(${idx}, 0, 'keyword', this.value)">
<span class="text-teal-600 font-bold">=></span>
- <input type="text" value="${item.alias || ''}" placeholder="别名"
+ <input type="text" value="${item.alias || ''}" placeholder="${t('freq.aliasPlaceholder')}"
class="flex-1 px-3 py-2 border border-gray-300 rounded focus:border-teal-500 outline-none text-sm"
onblur="updateAliasItem(${idx}, 0, 'alias', this.value)">
</div>
<div class="flex items-center justify-between mt-2">
<button onclick="openDeepSeekAI('group', ${idx})" class="text-xs text-blue-600 hover:text-blue-700 flex items-center gap-1">
- <i class="fa-solid fa-wand-magic-sparkles"></i>AI 写正则
+ <i class="fa-solid fa-wand-magic-sparkles"></i>${t('freq.aiWriteRegex')}
</button>
<div class="text-[10px] text-gray-500">
- <i class="fa-solid fa-lightbulb mr-1"></i>示例:/胖东来|于东来/ => 胖东来
+ <i class="fa-solid fa-lightbulb mr-1"></i>${t('freq.aliasExample')}
</div>
</div>
</div>
@@ -1850,7 +1871,7 @@ function renderFrequencyPanel(data) {
<div class="flex items-center flex-1 gap-2">
${jumpIcon}
${indexBadge}
- <span class="text-[10px] bg-purple-500 text-white px-2 py-0.5 rounded font-bold">连续别名组</span>
+ <span class="text-[10px] bg-purple-500 text-white px-2 py-0.5 rounded font-bold">${t('wgModal.multiAlias')}</span>
${relatedGroupBadge}
</div>
<button onclick="event.stopPropagation(); removeWordGroup(${idx})" class="text-red-500 hover:text-red-700 text-xs">
@@ -1859,15 +1880,15 @@ function renderFrequencyPanel(data) {
</div>
<div class="bg-white rounded p-3 border border-purple-200 space-y-2 editable-area" onclick="event.stopPropagation()">
<div class="text-xs text-gray-600 mb-2 font-bold">
- 别名列表(无空行分隔):
+ ${t('freq.aliasList')}
</div>
${group.items.map((item, itemIdx) => `
<div class="flex items-center gap-2">
- <input type="text" value="${item.keyword || ''}" placeholder="/正则/ 或 关键词"
+ <input type="text" value="${item.keyword || ''}" placeholder="${t('freq.regexPlaceholder')}"
class="flex-1 px-3 py-2 border border-gray-300 rounded focus:border-purple-500 outline-none text-sm font-mono"
onblur="updateAliasItem(${idx}, ${itemIdx}, 'keyword', this.value)">
<span class="text-purple-600 font-bold">=></span>
- <input type="text" value="${item.alias || ''}" placeholder="别名"
+ <input type="text" value="${item.alias || ''}" placeholder="${t('freq.aliasPlaceholder')}"
class="flex-1 px-3 py-2 border border-gray-300 rounded focus:border-purple-500 outline-none text-sm"
onblur="updateAliasItem(${idx}, ${itemIdx}, 'alias', this.value)">
<button onclick="removeAliasItem(${idx}, ${itemIdx})" class="text-red-500 hover:text-red-700 text-xs">
@@ -1877,10 +1898,10 @@ function renderFrequencyPanel(data) {
`).join('')}
<div class="flex items-center justify-between mt-2">
<button onclick="openDeepSeekAI('group', ${idx})" class="text-xs text-blue-600 hover:text-blue-700 flex items-center gap-1">
- <i class="fa-solid fa-wand-magic-sparkles"></i>AI 写正则
+ <i class="fa-solid fa-wand-magic-sparkles"></i>${t('freq.aiWriteRegex')}
</button>
<div class="text-[10px] text-gray-500">
- <i class="fa-solid fa-info-circle mr-1"></i>这些别名行在配置文件中无空行分隔,属于同一组
+ <i class="fa-solid fa-info-circle mr-1"></i>${t('freq.aliasHint')}
</div>
</div>
</div>
@@ -1894,7 +1915,7 @@ function renderFrequencyPanel(data) {
<div class="flex items-center flex-1 gap-2">
${jumpIcon}
${indexBadge}
- <span class="text-[10px] bg-gray-500 text-white px-2 py-0.5 rounded font-bold">普通词组</span>
+ <span class="text-[10px] bg-gray-500 text-white px-2 py-0.5 rounded font-bold">${t('wgModal.plain')}</span>
${relatedGroupBadge}
</div>
<button onclick="event.stopPropagation(); removeWordGroup(${idx})" class="text-red-500 hover:text-red-700 text-xs">
@@ -1914,14 +1935,14 @@ function renderFrequencyPanel(data) {
</span>
`;
}).join('')}
- <input type="text" class="tag-input" placeholder="输入关键词后按回车..."
+ <input type="text" class="tag-input" placeholder="${t('freq.keywordPlaceholder')}"
onkeydown="handleKeywordInput(event, ${idx})">
</div>
<div class="flex items-center justify-between mt-2">
<button onclick="openDeepSeekAI('group', ${idx})" class="text-xs text-blue-600 hover:text-blue-700 flex items-center gap-1">
- <i class="fa-solid fa-wand-magic-sparkles"></i>AI 写正则
+ <i class="fa-solid fa-wand-magic-sparkles"></i>${t('freq.aiWriteRegex')}
</button>
- <div class="text-[10px] text-gray-400">${group.keywords.length} 个关键词</div>
+ <div class="text-[10px] text-gray-400">${group.keywords.length}${t('freq.nKeywords')}</div>
</div>
</div>
</div>
@@ -1936,27 +1957,27 @@ function renderFrequencyPanel(data) {
<div class="flex items-start gap-3">
<i class="fa-solid fa-book text-blue-600 text-lg mt-0.5"></i>
<div class="flex-1">
- <h3 class="text-sm font-bold text-gray-800 mb-2">四种词组类型说明</h3>
+ <h3 class="text-sm font-bold text-gray-800 mb-2">${t('freq.typesTitle')}</h3>
<div class="grid grid-cols-2 gap-3 text-xs">
<div class="bg-white rounded p-2 border-l-4 border-orange-500">
- <div class="font-bold text-orange-700 mb-1">组别名</div>
- <div class="text-gray-600 font-mono text-[10px] mb-1">[东亚]<br>日本<br>韩国</div>
- <div class="text-gray-500 text-[10px]">多个关键词,统一显示为组名</div>
+ <div class="font-bold text-orange-700 mb-1">${t('freq.groupAlias')}</div>
+ <div class="text-gray-600 font-mono text-[10px] mb-1">[East Asia]<br>Japan<br>Korea</div>
+ <div class="text-gray-500 text-[10px]">${t('freq.groupAliasDesc')}</div>
</div>
<div class="bg-white rounded p-2 border-l-4 border-teal-500">
- <div class="font-bold text-teal-700 mb-1">单个别名</div>
- <div class="text-gray-600 font-mono text-[10px] mb-1">/胖东来|于东来/ => 胖东来</div>
- <div class="text-gray-500 text-[10px]">正则匹配,显示为别名</div>
+ <div class="font-bold text-teal-700 mb-1">${t('freq.singleAlias')}</div>
+ <div class="text-gray-600 font-mono text-[10px] mb-1">/termA|termB/ => DisplayName</div>
+ <div class="text-gray-500 text-[10px]">${t('freq.singleAliasDesc')}</div>
</div>
<div class="bg-white rounded p-2 border-l-4 border-purple-500">
- <div class="font-bold text-purple-700 mb-1">连续别名组</div>
- <div class="text-gray-600 font-mono text-[10px] mb-1">/智元|稚晖君/ => 智元<br>/众擎|EngineAI/ => 众擎</div>
- <div class="text-gray-500 text-[10px]">多个别名无空行分隔</div>
+ <div class="font-bold text-purple-700 mb-1">${t('freq.multiAlias')}</div>
+ <div class="text-gray-600 font-mono text-[10px] mb-1">/brandA|aliasA/ => BrandA<br>/brandB|aliasB/ => BrandB</div>
+ <div class="text-gray-500 text-[10px]">${t('freq.multiAliasDesc')}</div>
</div>
<div class="bg-white rounded p-2 border-l-4 border-gray-500">
- <div class="font-bold text-gray-700 mb-1">普通词组</div>
- <div class="text-gray-600 font-mono text-[10px] mb-1">申奥</div>
- <div class="text-gray-500 text-[10px]">普通关键词</div>
+ <div class="font-bold text-gray-700 mb-1">${t('freq.plain')}</div>
+ <div class="text-gray-600 font-mono text-[10px] mb-1">keyword</div>
+ <div class="text-gray-500 text-[10px]">${t('freq.plainDesc')}</div>
</div>
</div>
</div>
@@ -1967,10 +1988,10 @@ function renderFrequencyPanel(data) {
<div class="bg-white rounded-lg border border-gray-200 p-5">
<div class="flex items-center justify-between mb-3">
<h3 class="text-sm font-bold text-gray-700">
- <i class="fa-solid fa-filter mr-2"></i>全局过滤词
+ <i class="fa-solid fa-filter mr-2"></i>${t('freq.globalFilter')}
</h3>
<button onclick="openDeepSeekAI('global')" class="text-xs text-blue-600 hover:text-blue-700 flex items-center gap-1">
- <i class="fa-solid fa-wand-magic-sparkles"></i>AI 写正则
+ <i class="fa-solid fa-wand-magic-sparkles"></i>${t('freq.aiWriteRegex')}
</button>
</div>
<div id="global-filter-tags" class="tag-input-container">
@@ -1980,10 +2001,10 @@ function renderFrequencyPanel(data) {
<button onclick="removeGlobalFilter('${f.replace(/'/g, "\\'")}')">×</button>
</span>
`).join('')}
- <input type="text" class="tag-input" placeholder="输入过滤词后按回车..." onkeydown="handleGlobalFilterInput(event)">
+ <input type="text" class="tag-input" placeholder="${t('freq.globalFilterPlaceholder')}" onkeydown="handleGlobalFilterInput(event)">
</div>
<div class="text-xs text-gray-500 mt-2">
- <i class="fa-solid fa-lightbulb mr-1"></i>提示:支持正则表达式(用 /.../ 包裹)
+ <i class="fa-solid fa-lightbulb mr-1"></i>${t('common.hint')}${t('freq.regexHint')}
</div>
</div>
@@ -1991,10 +2012,10 @@ function renderFrequencyPanel(data) {
<div class="bg-white rounded-lg border border-gray-200 p-5">
<div class="flex items-center justify-between mb-3">
<h3 class="text-sm font-bold text-gray-700">
- <i class="fa-solid fa-layer-group mr-2"></i>关键词组 <span class="text-xs text-gray-400 font-normal">(${data.wordGroups.length} 个词组)</span>
+ <i class="fa-solid fa-layer-group mr-2"></i>${t('freq.keywordGroups')} <span class="text-xs text-gray-400 font-normal">(${data.wordGroups.length}${t('freq.nGroups')})</span>
</h3>
<button onclick="addWordGroup('top')" class="text-xs bg-blue-600 text-white px-3 py-1 rounded hover:bg-blue-700">
- <i class="fa-solid fa-plus mr-1"></i>添加词组
+ <i class="fa-solid fa-plus mr-1"></i>${t('freq.addGroup')}
</button>
</div>
<div id="word-groups-container" class="space-y-3">
@@ -2018,7 +2039,7 @@ function renderFrequencyPanel(data) {
<div class="mt-4 flex justify-center">
<button onclick="addWordGroup('bottom')" class="text-sm bg-gradient-to-r from-blue-500 to-blue-600 text-white px-6 py-2 rounded-lg hover:from-blue-600 hover:to-blue-700 shadow-sm transition-all flex items-center gap-2">
<i class="fa-solid fa-plus-circle"></i>
- <span>在底部添加词组</span>
+ <span>${t('freq.addGroupBottom')}</span>
</button>
</div>
</div>
@@ -2362,7 +2383,7 @@ window.removeAliasItem = function(groupIndex, itemIndex) {
// DeepSeek AI 辅助
window.openDeepSeekAI = function(type, groupIndex) {
- const userInput = window.prompt('请输入核心关键词(例如:华为):');
+ const userInput = window.prompt(t('prompt.enterCoreKeyword'));
if (!userInput) return;
const promptText = `我正在配置一个新闻聚合系统,需要通过 Python 正则表达式 抓取关于【${userInput}】的新闻。
@@ -2417,11 +2438,11 @@ window.openDeepSeekAI = function(type, groupIndex) {
document.body.removeChild(textArea);
if (copySuccess) {
- if (confirm(`提示词已复制到剪贴板!\n\n关键词:${userInput}\n\n点击【确定】跳转 DeepSeek 官网,直接粘贴 (Ctrl+V) 即可。`)) {
+ if (confirm(t('ai.promptCopied') + '\n\n' + t('ai.keyword') + userInput + '\n\n' + t('ai.goDeepSeek'))) {
window.open('https://chat.deepseek.com/', '_blank');
}
} else {
- prompt('自动复制失败,请手动复制以下内容,然后自行打开 DeepSeek:', promptText);
+ prompt(t('ai.copyFailed'), promptText);
window.open('https://chat.deepseek.com/', '_blank');
}
}
@@ -2449,7 +2470,7 @@ function renderPlatformsList() {
const platforms = parsePlatformsFromYaml();
if (platforms.length === 0) {
- container.innerHTML = `<div class="text-xs text-gray-400 italic">暂无平台,请添加</div>`;
+ container.innerHTML = `<div class="text-xs text-gray-400 italic">${t('freq.noPlatforms')}</div>`;
return;
}
@@ -2460,7 +2481,7 @@ function renderPlatformsList() {
<span class="text-xs font-medium text-gray-700">${p.name}</span>
<span class="text-[10px] text-gray-400">(${p.id})</span>
</div>
- <button onclick="removePlatform(${idx})" class="text-red-400 hover:text-red-600 text-xs" title="删除">
+ <button onclick="removePlatform(${idx})" class="text-red-400 hover:text-red-600 text-xs" title="${t('common.delete')}">
<i class="fa-solid fa-trash"></i>
</button>
</div>
@@ -2484,7 +2505,7 @@ window.removePlatform = function(index) {
if (index < 0 || index >= platforms.length) return;
const platformName = platforms[index].name;
- if (!confirm(`确定要删除平台 "${platformName}" 吗?`)) return;
+ if (!confirm(t('confirm.deletePlatform', platformName))) return;
platforms.splice(index, 1);
updatePlatformsInYaml(platforms);
@@ -2605,11 +2626,11 @@ function updatePlatformsInYaml(platforms) {
// ==========================================
const DISPLAY_REGIONS_DEF = [
- { key: "hotlist", label: "热榜区域" },
- { key: "new_items", label: "新增热点区域" },
- { key: "rss", label: "RSS 订阅区域" },
- { key: "standalone", label: "独立展示区" },
- { key: "ai_analysis", label: "AI 分析区域" }
+ { key: "hotlist", labelKey: "region.hotlist" },
+ { key: "new_items", labelKey: "region.new_items" },
+ { key: "rss", labelKey: "region.rss" },
+ { key: "standalone", labelKey: "region.standalone" },
+ { key: "ai_analysis", labelKey: "region.ai_analysis" }
];
// 从 YAML 解析 display.regions,严格按照 region_order 定义顺序
@@ -2627,7 +2648,7 @@ function parseDisplayRegionsFromYaml() {
const def = DISPLAY_REGIONS_DEF.find(d => d.key === normalizedKey);
return {
key: normalizedKey,
- label: def ? def.label : normalizedKey,
+ label: def ? t(def.labelKey) : normalizedKey,
enabled: regionStates[normalizedKey] !== undefined ? regionStates[normalizedKey] : false
};
});
@@ -2641,7 +2662,7 @@ function parseDisplayRegionsFromYaml() {
if (def) {
regions.push({
key: normalizedKey,
- label: def.label,
+ label: t(def.labelKey),
enabled: regionStates[key]
});
}
@@ -2653,7 +2674,7 @@ function parseDisplayRegionsFromYaml() {
// 默认返回所有区域(禁用状态)
return DISPLAY_REGIONS_DEF.map(def => ({
key: def.key,
- label: def.label,
+ label: t(def.labelKey),
enabled: false
}));
}
@@ -2875,7 +2896,7 @@ function renderRssFeedsList() {
const feeds = parseRssFeedsFromYaml();
if (feeds.length === 0) {
- container.innerHTML = `<div class="text-xs text-gray-400 italic">暂无 RSS 源,请添加</div>`;
+ container.innerHTML = `<div class="text-xs text-gray-400 italic">${t('freq.noRssFeeds')}</div>`;
return;
}
@@ -2886,16 +2907,16 @@ function renderRssFeedsList() {
<i class="fa-solid fa-rss text-orange-400"></i>
<span class="text-xs font-medium text-gray-700 truncate">${f.name}</span>
<span class="text-[10px] text-gray-400">(${f.id})</span>
- ${f.enabled === false ? '<span class="text-[9px] bg-gray-200 text-gray-500 px-1 rounded">已禁用</span>' : ''}
+ ${f.enabled === false ? '<span class="text-[9px] bg-gray-200 text-gray-500 px-1 rounded">' + t('rssModal.disabled') + '</span>' : ''}
</div>
<div class="flex items-center gap-1">
- <button onclick="editRssFeed(${idx})" class="text-blue-400 hover:text-blue-600 text-xs px-1" title="编辑">
+ <button onclick="editRssFeed(${idx})" class="text-blue-400 hover:text-blue-600 text-xs px-1" title="${t('common.edit')}">
<i class="fa-solid fa-pen"></i>
</button>
- <button onclick="toggleRssFeed(${idx})" class="text-gray-400 hover:text-gray-600 text-xs px-1" title="${f.enabled === false ? '启用' : '禁用'}">
+ <button onclick="toggleRssFeed(${idx})" class="text-gray-400 hover:text-gray-600 text-xs px-1" title="${f.enabled === false ? t('common.enable') : t('common.disable')}">
<i class="fa-solid fa-${f.enabled === false ? 'eye' : 'eye-slash'}"></i>
</button>
- <button onclick="removeRssFeed(${idx})" class="text-red-400 hover:text-red-600 text-xs px-1" title="删除">
+ <button onclick="removeRssFeed(${idx})" class="text-red-400 hover:text-red-600 text-xs px-1" title="${t('common.delete')}">
<i class="fa-solid fa-trash"></i>
</button>
</div>
@@ -2911,7 +2932,7 @@ window.removeRssFeed = function(index) {
if (index < 0 || index >= feeds.length) return;
const feedName = feeds[index].name;
- if (!confirm(`确定要删除 RSS 源 "${feedName}" 吗?`)) return;
+ if (!confirm(t('confirm.deleteRss', feedName))) return;
feeds.splice(index, 1);
updateRssFeedsInYaml(feeds);
@@ -3063,8 +3084,8 @@ function openRssModalWithData(feed, editIndex) {
const title = modal.querySelector('h3');
if (title) {
title.innerHTML = editIndex >= 0 ?
- '<i class="fa-solid fa-rss mr-2 text-orange-500"></i>编辑 RSS 源' :
- '<i class="fa-solid fa-rss mr-2 text-orange-500"></i>添加 RSS 源';
+ '<i class="fa-solid fa-rss mr-2 text-orange-500"></i>' + t('rssModal.editTitle') :
+ '<i class="fa-solid fa-rss mr-2 text-orange-500"></i>' + t('rssModal.addTitle');
}
modal.classList.remove('hidden');
@@ -3093,7 +3114,7 @@ window.confirmAddRss = function() {
const maxAge = document.getElementById('rss-max-age').value.trim();
if (!id || !name || !url) {
- alert('请填写完整信息:ID、名称和 URL 都是必填项');
+ alert(t('alert.fillRequired'));
return;
}
@@ -3143,7 +3164,7 @@ function renderStandaloneLists() {
// Render Platforms
if (availablePlatforms.length === 0) {
- platformsContainer.innerHTML = `<div class="col-span-2 text-xs text-gray-400 italic">暂无可用平台</div>`;
+ platformsContainer.innerHTML = `<div class="col-span-2 text-xs text-gray-400 italic">${t('freq.noAvailPlatforms')}</div>`;
} else {
platformsContainer.innerHTML = availablePlatforms.map(p => {
const isChecked = standaloneConfig.platforms.includes(p.id);
@@ -3162,7 +3183,7 @@ function renderStandaloneLists() {
// Render RSS
if (availableRss.length === 0) {
- rssContainer.innerHTML = `<div class="text-xs text-gray-400 italic">暂无可用 RSS 源</div>`;
+ rssContainer.innerHTML = `<div class="text-xs text-gray-400 italic">${t('freq.noAvailRss')}</div>`;
} else {
rssContainer.innerHTML = availableRss.map(f => {
const isChecked = standaloneConfig.rss_feeds.includes(f.id);
@@ -3287,13 +3308,13 @@ window.checkVersion = async function() {
const btn = document.getElementById('version-check-btn');
const originalHTML = btn.innerHTML;
- btn.innerHTML = '<i class="fa-solid fa-spinner fa-spin"></i><span>检测中...</span>';
+ btn.innerHTML = '<i class="fa-solid fa-spinner fa-spin"></i><span>' + t('version.checking') + '</span>';
btn.disabled = true;
try {
const versionRes = await fetchWithFallback(REMOTE_VERSION_URL);
if (!versionRes.ok) {
- throw new Error(`版本信息获取失败: ${versionRes.status}`);
+ throw new Error(t('version.fetchFailed', String(versionRes.status)));
}
const versionConfigText = await versionRes.text();
@@ -3320,14 +3341,14 @@ window.checkVersion = async function() {
const latestVersion = versionMap[fileName];
if (!latestVersion) {
- throw new Error(`未在远程版本清单中找到 ${fileName}`);
+ throw new Error(t('version.notFoundRemote', fileName));
}
showVersionComparisonModal(fileName, currentVersion, latestVersion);
} catch (err) {
console.error('版本检测失败:', err);
- showToast(`版本检测失败: ${err.message}`, 'error');
+ showToast(t('toast.versionCheckFailed') + err.message, 'error');
} finally {
btn.innerHTML = originalHTML;
btn.disabled = false;
@@ -3352,37 +3373,37 @@ function showVersionComparisonModal(fileName, currentVersion, latestVersion) {
if (!currentVersion) {
statusIcon = '<i class="fa-solid fa-question-circle text-gray-500 text-3xl"></i>';
- statusText = '未检测到版本信息';
+ statusText = t('version.noVersion');
statusColor = 'text-gray-600';
actionButtons = `
- <button onclick="closeVersionModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg">关闭</button>
+ <button onclick="closeVersionModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg">${t('version.close')}</button>
<button onclick="updateToLatest()" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700">
- <i class="fa-solid fa-download mr-1"></i>更新到最新版本
+ <i class="fa-solid fa-download mr-1"></i>${t('version.updateToLatest')}
</button>
`;
} else if (comparison < 0) {
statusIcon = '<i class="fa-solid fa-arrow-up text-orange-500 text-3xl"></i>';
- statusText = '发现新版本';
+ statusText = t('version.newVersion');
statusColor = 'text-orange-600';
actionButtons = `
- <button onclick="closeVersionModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg">稍后更新</button>
+ <button onclick="closeVersionModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg">${t('version.updateLater')}</button>
<button onclick="updateToLatest()" class="px-4 py-2 bg-orange-600 text-white rounded-lg hover:bg-orange-700">
- <i class="fa-solid fa-download mr-1"></i>立即更新
+ <i class="fa-solid fa-download mr-1"></i>${t('version.updateNow')}
</button>
`;
} else if (comparison > 0) {
statusIcon = '<i class="fa-solid fa-flask text-purple-500 text-3xl"></i>';
- statusText = '当前版本较新(开发版本?)';
+ statusText = t('version.devVersion');
statusColor = 'text-purple-600';
actionButtons = `
- <button onclick="closeVersionModal()" class="px-4 py-2 bg-gray-100 text-gray-600 hover:bg-gray-200 rounded-lg">关闭</button>
+ <button onclick="closeVersionModal()" class="px-4 py-2 bg-gray-100 text-gray-600 hover:bg-gray-200 rounded-lg">${t('version.close')}</button>
`;
} else {
statusIcon = '<i class="fa-solid fa-check-circle text-green-500 text-3xl"></i>';
- statusText = '已是最新版本';
+ statusText = t('version.upToDate');
statusColor = 'text-green-600';
actionButtons = `
- <button onclick="closeVersionModal()" class="px-4 py-2 bg-gray-100 text-gray-600 hover:bg-gray-200 rounded-lg">关闭</button>
+ <button onclick="closeVersionModal()" class="px-4 py-2 bg-gray-100 text-gray-600 hover:bg-gray-200 rounded-lg">${t('version.close')}</button>
`;
}
@@ -3393,7 +3414,7 @@ function showVersionComparisonModal(fileName, currentVersion, latestVersion) {
<div class="modal-content" style="max-width: 480px;">
<div class="flex items-center justify-between mb-4">
<h3 class="text-lg font-bold text-gray-800">
- <i class="fa-solid fa-code-compare mr-2 text-blue-500"></i>版本检测结果
+ <i class="fa-solid fa-code-compare mr-2 text-blue-500"></i>${t('version.title')}
</h3>
<button onclick="closeVersionModal()" class="text-gray-400 hover:text-gray-600">
<i class="fa-solid fa-times text-xl"></i>
@@ -3407,18 +3428,18 @@ function showVersionComparisonModal(fileName, currentVersion, latestVersion) {
<div class="bg-gray-50 rounded-lg p-4 space-y-3 mb-4">
<div class="flex items-center justify-between text-sm">
- <span class="text-gray-600">配置文件</span>
+ <span class="text-gray-600">${t('version.configFile')}</span>
<span class="font-mono font-bold text-gray-800">${fileName}</span>
</div>
<div class="border-t border-gray-200"></div>
<div class="flex items-center justify-between text-sm">
- <span class="text-gray-600">当前版本</span>
+ <span class="text-gray-600">${t('version.currentVersion')}</span>
<span class="font-mono font-bold ${currentVersion ? 'text-blue-600' : 'text-gray-400'}">
- ${currentVersion ? 'v' + currentVersion : '未知'}
+ ${currentVersion ? 'v' + currentVersion : t('version.unknown')}
</span>
</div>
<div class="flex items-center justify-between text-sm">
- <span class="text-gray-600">最新版本</span>
+ <span class="text-gray-600">${t('version.latestVersion')}</span>
<span class="font-mono font-bold text-green-600">v${latestVersion}</span>
</div>
</div>
@@ -3426,7 +3447,7 @@ function showVersionComparisonModal(fileName, currentVersion, latestVersion) {
${comparison < 0 || !currentVersion ? `
<div class="text-xs text-gray-500 bg-yellow-50 border border-yellow-200 rounded p-3 mb-4">
<i class="fa-solid fa-lightbulb mr-1 text-yellow-600"></i>
- <strong>提示:</strong>更新将从 GitHub 加载最新的 ${fileName},你当前的修改将被覆盖。建议先复制保存你的自定义配置。
+ <strong>${t('common.hint')}</strong>${t('version.updateHint', fileName)}
</div>
` : ''}
@@ -3450,17 +3471,17 @@ window.closeVersionModal = function() {
// 预定义可用平台列表 (仅包含官方默认支持的平台)
const PRESET_PLATFORMS = [
- { key: 'toutiao', name: '今日头条' },
- { key: 'baidu', name: '百度热搜' },
- { key: 'wallstreetcn-hot', name: '华尔街见闻' },
- { key: 'thepaper', name: '澎湃新闻' },
- { key: 'bilibili-hot-search', name: 'bilibili 热搜' },
- { key: 'cls-hot', name: '财联社热门' },
- { key: 'ifeng', name: '凤凰网' },
- { key: 'tieba', name: '贴吧' },
- { key: 'weibo', name: '微博' },
- { key: 'douyin', name: '抖音' },
- { key: 'zhihu', name: '知乎' }
+ { key: 'toutiao', nameKey: 'plat.toutiao' },
+ { key: 'baidu', nameKey: 'plat.baidu' },
+ { key: 'wallstreetcn-hot', nameKey: 'plat.wallstreetcn-hot' },
+ { key: 'thepaper', nameKey: 'plat.thepaper' },
+ { key: 'bilibili-hot-search', nameKey: 'plat.bilibili-hot-search' },
+ { key: 'cls-hot', nameKey: 'plat.cls-hot' },
+ { key: 'ifeng', nameKey: 'plat.ifeng' },
+ { key: 'tieba', nameKey: 'plat.tieba' },
+ { key: 'weibo', nameKey: 'plat.weibo' },
+ { key: 'douyin', nameKey: 'plat.douyin' },
+ { key: 'zhihu', nameKey: 'plat.zhihu' }
];
/**
@@ -3545,7 +3566,7 @@ function renderAvailablePlatforms() {
if (available.length === 0) {
if (tip) {
tip.classList.remove('hidden');
- tip.innerHTML = `<i class="fa-solid fa-check-circle text-green-500 mr-2"></i>所有预设平台已添加`;
+ tip.innerHTML = `<i class="fa-solid fa-check-circle text-green-500 mr-2"></i>${t('platModal.allAdded')}`;
}
} else {
if (tip) tip.classList.add('hidden');
@@ -3553,14 +3574,14 @@ function renderAvailablePlatforms() {
available.forEach(p => {
const div = document.createElement('div');
div.className = 'flex items-center justify-between p-3 border border-gray-100 rounded hover:bg-blue-50 cursor-pointer transition-colors group';
- div.onclick = () => confirmAddPlatform(p.key, p.name);
+ div.onclick = () => confirmAddPlatform(p.key, t(p.nameKey));
div.innerHTML = `
<div class="flex items-center gap-3">
<div class="w-8 h-8 rounded bg-gray-100 flex items-center justify-center text-gray-500 group-hover:bg-white group-hover:text-blue-600">
<i class="fa-solid fa-cube"></i>
</div>
<div>
- <div class="font-bold text-gray-800 text-sm">${p.name}</div>
+ <div class="font-bold text-gray-800 text-sm">${t(p.nameKey)}</div>
<div class="text-xs text-gray-400 font-mono">${p.key}</div>
</div>
</div>
@@ -3589,21 +3610,21 @@ window.confirmAddPlatform = function(key, name) {
if (nameInput) platformName = nameInput.value.trim();
if (!platformKey) {
- alert('请输入平台 Key');
+ alert(t('alert.enterPlatformKey'));
return;
}
if (!platformName) {
platformName = platformKey;
}
} else if (currentPlatformTab === 'select' && !key) {
- alert('请直接点击上方列表中的平台进行添加');
+ alert(t('alert.clickToAdd'));
return;
}
// 检查是否已存在
const currentPlatforms = parsePlatformsFromYaml();
if (currentPlatforms.find(p => p.id === platformKey)) {
- alert(`平台 ${platformKey} 已存在!`);
+ alert(t('toast.platformExists', platformKey));
return;
}
@@ -3627,7 +3648,7 @@ window.confirmAddPlatform = function(key, name) {
renderPlatformsList();
- showToast(`平台 ${platformName} 已添加`, 'success');
+ showToast(t('toast.platformAdded', platformName), 'success');
}
// 绑定到全局
@@ -3635,20 +3656,20 @@ window.updateToLatest = async function() {
closeVersionModal();
const currentTab = getCurrentTab();
- const fileName = currentTab === 'config' ? 'config.yaml' : 'frequency_words.txt';
+ const type = currentTab === 'config' ? 'config' : currentTab === 'timeline' ? 'timeline' : 'frequency';
+ const fileName = remoteConfigName(type);
- if (!confirm(`确定要从 GitHub 更新 ${fileName} 到最新版本吗?\n\n你当前的自定义配置将被覆盖,建议先复制保存。`)) {
+ if (!confirm(t('confirm.updateFile', fileName))) {
return;
}
- showToast('正在加载最新版本...', 'info');
+ showToast(t('toast.loadingLatest'), 'info');
try {
- const url = currentTab === 'config' ? REMOTE_CONFIG_URL : REMOTE_FREQUENCY_URL;
- const res = await fetchWithFallback(url);
+ const res = await fetchWithFallback(remoteConfigUrl(type));
if (!res.ok) {
- throw new Error(`加载失败: ${res.status}`);
+ throw new Error(t('toast.loadFailed') + res.status);
}
const text = await res.text();
@@ -3657,7 +3678,7 @@ window.updateToLatest = async function() {
try {
jsyaml.load(text);
} catch (yamlErr) {
- showToast(`YAML 语法错误: ${yamlErr.message}`, 'error');
+ showToast(t('toast.yamlError') + yamlErr.message, 'error');
return;
}
document.getElementById('yaml-editor').value = text;
@@ -3671,11 +3692,11 @@ window.updateToLatest = async function() {
saveToLocalStorage();
- showToast(`已更新到最新版本`, 'success');
+ showToast(t('toast.updatedToLatest'), 'success');
} catch (err) {
console.error('更新失败:', err);
- showToast(`更新失败: ${err.message}`, 'error');
+ showToast(t('toast.updateFailed') + err.message, 'error');
}
}
@@ -3718,7 +3739,7 @@ const PRESET_META = {
custom: { icon: 'fa-sliders', color: 'text-purple-500', bg: 'bg-purple-50' }
};
-const DAY_NAMES = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'];
+function getDayNames() { return [t('day.1'), t('day.2'), t('day.3'), t('day.4'), t('day.5'), t('day.6'), t('day.7')]; }
/**
* 从当前 config.yaml 中读取 schedule.preset
@@ -3764,8 +3785,8 @@ function syncTimelineToUI() {
panel.innerHTML = `
<div class="text-center py-12 text-gray-400">
<i class="fa-solid fa-calendar-xmark text-4xl mb-3"></i>
- <p class="text-sm">请在左侧粘贴 timeline.yaml 内容</p>
- <p class="text-xs mt-1">或点击右上角「加载官网最新配置」</p>
+ <p class="text-sm">${t('tl.pasteTimeline')}</p>
+ <p class="text-xs mt-1">${t('tl.orLoadConfig')}</p>
</div>`;
return;
}
@@ -3774,7 +3795,7 @@ function syncTimelineToUI() {
// ── Layer 1: 预设模式选择卡片 ──
html += `<div class="mb-6">
- <div class="tl-section-title"><i class="fa-solid fa-swatchbook"></i>调度模式</div>
+ <div class="tl-section-title"><i class="fa-solid fa-swatchbook"></i>${t('tl.scheduleMode')}</div>
<div class="grid grid-cols-2 gap-3" id="tl-preset-grid">`;
// 收集所有预设名
@@ -3791,7 +3812,7 @@ function syncTimelineToUI() {
const isProtected = ['morning_evening', 'always_on', 'office_hours', 'night_owl', 'custom'].includes(name);
html += `
<div class="tl-preset-card ${isActive ? 'selected' : ''}" data-preset="${name}">
- ${meta.recommend ? '<div class="tl-recommend-badge">推荐</div>' : ''}
+ ${meta.recommend ? '<div class="tl-recommend-badge">' + t('tl.recommend') + '</div>' : ''}
<div class="flex items-center gap-3 cursor-pointer" onclick="selectTimelinePreset('${name}')">
<div class="tl-card-icon ${meta.bg} ${meta.color}"><i class="fa-solid ${meta.icon}"></i></div>
<div class="flex-1 min-w-0">
@@ -3800,10 +3821,10 @@ function syncTimelineToUI() {
</div>
</div>
<div class="tl-card-actions">
- <button onclick="event.stopPropagation();duplicateTlPreset('${name}')" class="tl-card-action-btn" title="复制"><i class="fa-regular fa-copy"></i></button>
- ${!isProtected ? `<button onclick="event.stopPropagation();deleteTlPreset('${name}')" class="tl-card-action-btn text-red-400 hover:text-red-600" title="删除"><i class="fa-regular fa-trash-can"></i></button>` : ''}
+ <button onclick="event.stopPropagation();duplicateTlPreset('${name}')" class="tl-card-action-btn" title="${t('common.copy')}"><i class="fa-regular fa-copy"></i></button>
+ ${!isProtected ? `<button onclick="event.stopPropagation();deleteTlPreset('${name}')" class="tl-card-action-btn text-red-400 hover:text-red-600" title="${t('common.delete')}"><i class="fa-regular fa-trash-can"></i></button>` : ''}
</div>
- ${isActive ? '<div class="absolute bottom-1 right-2 text-[9px] text-blue-500 font-bold"><i class="fa-solid fa-check-circle mr-0.5"></i>当前</div>' : ''}
+ ${isActive ? '<div class="absolute bottom-1 right-2 text-[9px] text-blue-500 font-bold"><i class="fa-solid fa-check-circle mr-0.5"></i>' + t('tl.current') + '</div>' : ''}
</div>`;
});
@@ -3813,8 +3834,8 @@ function syncTimelineToUI() {
<div class="flex items-center gap-3">
<div class="tl-card-icon bg-gray-50 text-gray-400"><i class="fa-solid fa-plus"></i></div>
<div>
- <div class="text-sm font-bold text-gray-500">新建模式</div>
- <div class="text-[10px] text-gray-400">创建自定义调度方案</div>
+ <div class="text-sm font-bold text-gray-500">${t('tl.newMode')}</div>
+ <div class="text-[10px] text-gray-400">${t('tl.newModeDesc')}</div>
</div>
</div>
</div>`;
@@ -3827,7 +3848,7 @@ function syncTimelineToUI() {
if (!config) {
html += `<div class="text-center py-6 text-gray-400 text-sm">
<i class="fa-solid fa-triangle-exclamation text-amber-400 mr-1"></i>
- 未找到预设「${activePreset}」的配置
+ ${t('tl.presetNotFound', activePreset)}
</div>`;
panel.innerHTML = html;
return;
@@ -3855,7 +3876,7 @@ function renderWeekView(config, presetName) {
// 时间刻度
let html = `<div class="tl-week-view">
- <div class="tl-section-title mb-2"><i class="fa-solid fa-calendar-week"></i>周视图</div>
+ <div class="tl-section-title mb-2"><i class="fa-solid fa-calendar-week"></i>${t('tl.weekView')}</div>
<div class="tl-hour-markers">
<div style="width:2.5rem;flex-shrink:0"></div>
<div style="flex:1;display:flex;min-width:480px">`;
@@ -3879,7 +3900,7 @@ function renderWeekView(config, presetName) {
const isToday = d === todayIso;
html += `<div class="tl-week-row">
- <div class="tl-day-label ${isToday ? 'today' : ''}">${DAY_NAMES[d-1]}</div>
+ <div class="tl-day-label ${isToday ? 'today' : ''}">${getDayNames()[d-1]}</div>
<div class="tl-timeline-bar" data-day="${d}" onclick="onTlBarClick(event,'${presetName}',${d})">`;
// 渲染各时间段色块
@@ -3909,7 +3930,7 @@ function renderWeekView(config, presetName) {
const nowTime = new Date();
const nowH = nowTime.getHours() + nowTime.getMinutes() / 60;
const nowLeftPct = (nowH / 24 * 100).toFixed(2);
- html += `<div class="tl-now-line" style="left:${nowLeftPct}%" title="当前时间 ${String(nowTime.getHours()).padStart(2,'0')}:${String(nowTime.getMinutes()).padStart(2,'0')}"></div>`;
+ html += `<div class="tl-now-line" style="left:${nowLeftPct}%" title="${String(nowTime.getHours()).padStart(2,'0')}:${String(nowTime.getMinutes()).padStart(2,'0')}"></div>`;
}
html += `</div></div>`;
@@ -3917,11 +3938,11 @@ function renderWeekView(config, presetName) {
// 图例
html += `<div class="tl-legend">
- <div class="tl-legend-item"><div class="tl-legend-color tl-block-push"></div>推送</div>
- <div class="tl-legend-item"><div class="tl-legend-color tl-block-analyze"></div>AI 分析</div>
- <div class="tl-legend-item"><div class="tl-legend-color tl-block-push-analyze"></div>推送 + 分析</div>
- <div class="tl-legend-item"><div class="tl-legend-color tl-block-collect"></div>仅采集</div>
- <div class="tl-legend-item"><div class="tl-legend-color" style="background:#f1f5f9;border:1px solid #e2e8f0"></div>默认 (default)</div>
+ <div class="tl-legend-item"><div class="tl-legend-color tl-block-push"></div>${t('tl.legend.push')}</div>
+ <div class="tl-legend-item"><div class="tl-legend-color tl-block-analyze"></div>${t('tl.legend.analyze')}</div>
+ <div class="tl-legend-item"><div class="tl-legend-color tl-block-push-analyze"></div>${t('tl.legend.pushAnalyze')}</div>
+ <div class="tl-legend-item"><div class="tl-legend-color tl-block-collect"></div>${t('tl.legend.collect')}</div>
+ <div class="tl-legend-item"><div class="tl-legend-color" style="background:#f1f5f9;border:1px solid #e2e8f0"></div>${t('tl.legend.default')}</div>
</div>`;
html += `</div>`;
@@ -3985,14 +4006,14 @@ function showTlTooltip(event, name, start, end, push, analyze, mode) {
const el = document.createElement('div');
el.className = 'tl-tooltip';
let features = [];
- if (push) features.push('<span style="color:#93c5fd">推送</span>');
- if (analyze) features.push('<span style="color:#c4b5fd">分析</span>');
- if (!push && !analyze) features.push('<span style="color:#94a3b8">仅采集</span>');
+ if (push) features.push('<span style="color:#93c5fd">' + t('tl.legend.push') + '</span>');
+ if (analyze) features.push('<span style="color:#c4b5fd">' + t('tl.legend.analyze') + '</span>');
+ if (!push && !analyze) features.push('<span style="color:#94a3b8">' + t('tl.legend.collect') + '</span>');
el.innerHTML = `<div style="font-weight:700;margin-bottom:2px">${name}</div>
<div style="font-size:11px;color:#9ca3af">${start} - ${end}</div>
<div style="margin-top:4px">${features.join(' / ')}</div>
- ${mode ? `<div style="font-size:10px;color:#9ca3af;margin-top:2px">模式: ${mode}</div>` : ''}`;
+ ${mode ? `<div style="font-size:10px;color:#9ca3af;margin-top:2px">${t('tl.report')} ${mode}</div>` : ''}`;
document.body.appendChild(el);
tlTooltipEl = el;
@@ -4033,11 +4054,11 @@ function renderPeriodDetails(config, presetName) {
// ── Default 配置(默认展开)──
html += `<div class="tl-collapsible mt-4">
<div class="tl-collapsible-header" onclick="toggleTlCollapsible(this)">
- <span><i class="fa-solid fa-gear mr-2 text-gray-400"></i>默认配置 (default)</span>
+ <span><i class="fa-solid fa-gear mr-2 text-gray-400"></i>${t('tl.defaultConfig')}</span>
<i class="fa-solid fa-chevron-down text-gray-400 text-xs"></i>
</div>
<div class="tl-collapsible-body">
- <div class="text-xs text-gray-500 mb-2">不在任何时间段内时,使用以下配置:</div>
+ <div class="text-xs text-gray-500 mb-2">${t('tl.defaultDesc')}</div>
${renderBehaviorToggles(defaults, presetName, 'default', defaults)}
</div>
</div>`;
@@ -4046,8 +4067,8 @@ function renderPeriodDetails(config, presetName) {
const periodEntries = Object.entries(periods);
html += `<div class="mt-6">
<div class="tl-section-title flex items-center justify-between">
- <span><i class="fa-solid fa-puzzle-piece"></i>时间段 (Periods)</span>
- <button onclick="openTlNewPeriodModal('${presetName}')" class="tl-add-btn"><i class="fa-solid fa-plus mr-1"></i>新增</button>
+ <span><i class="fa-solid fa-puzzle-piece"></i>${t('tl.periods')}</span>
+ <button onclick="openTlNewPeriodModal('${presetName}')" class="tl-add-btn"><i class="fa-solid fa-plus mr-1"></i>${t('tl.addNew')}</button>
</div>`;
if (periodEntries.length > 0) {
@@ -4064,8 +4085,8 @@ function renderPeriodDetails(config, presetName) {
</div>
<div class="flex items-center gap-2">
<span class="text-xs text-gray-500 font-mono">${p.start || '?'} - ${p.end || '?'}</span>
- <button onclick="duplicateTlPeriod('${presetName}','${key}')" class="tl-inline-btn" title="复制"><i class="fa-regular fa-copy"></i></button>
- <button onclick="deleteTlPeriod('${presetName}','${key}')" class="tl-inline-btn text-red-400 hover:text-red-600" title="删除"><i class="fa-regular fa-trash-can"></i></button>
+ <button onclick="duplicateTlPeriod('${presetName}','${key}')" class="tl-inline-btn" title="${t('common.copy')}"><i class="fa-regular fa-copy"></i></button>
+ <button onclick="deleteTlPeriod('${presetName}','${key}')" class="tl-inline-btn text-red-400 hover:text-red-600" title="${t('common.delete')}"><i class="fa-regular fa-trash-can"></i></button>
</div>
</div>
${renderBehaviorToggles(merged, presetName, key, p)}
@@ -4074,7 +4095,7 @@ function renderPeriodDetails(config, presetName) {
html += `</div>`;
} else {
html += `<div class="text-xs text-gray-400 text-center py-4">
- <i class="fa-solid fa-info-circle mr-1"></i>此模式无自定义时间段,全天使用 default 配置
+ <i class="fa-solid fa-info-circle mr-1"></i>${t('tl.noPeriods')}
</div>`;
}
@@ -4084,8 +4105,8 @@ function renderPeriodDetails(config, presetName) {
const dayPlanEntries = Object.entries(dayPlans);
html += `<div class="mt-6">
<div class="tl-section-title flex items-center justify-between">
- <span><i class="fa-solid fa-list-ol"></i>日计划 (Day Plans)</span>
- <button onclick="addTlDayPlan('${presetName}')" class="tl-add-btn"><i class="fa-solid fa-plus mr-1"></i>新增</button>
+ <span><i class="fa-solid fa-list-ol"></i>${t('tl.dayPlans')}</span>
+ <button onclick="addTlDayPlan('${presetName}')" class="tl-add-btn"><i class="fa-solid fa-plus mr-1"></i>${t('tl.addNew')}</button>
</div>`;
if (dayPlanEntries.length > 0) {
@@ -4097,7 +4118,7 @@ function renderPeriodDetails(config, presetName) {
html += `<div class="bg-white border border-gray-200 rounded-lg px-3 py-2 tl-dayplan-card">
<div class="flex items-center justify-between mb-1">
<span class="text-xs font-bold text-gray-700">${name}</span>
- <button onclick="deleteTlDayPlan('${presetName}','${name}')" class="tl-inline-btn text-red-400 hover:text-red-600" title="删除日计划"><i class="fa-regular fa-trash-can"></i></button>
+ <button onclick="deleteTlDayPlan('${presetName}','${name}')" class="tl-inline-btn text-red-400 hover:text-red-600" title="${t('common.delete')}"><i class="fa-regular fa-trash-can"></i></button>
</div>
<div class="flex flex-wrap gap-1 items-center tl-dayplan-sortable" data-plan-key="${name}">
${pList.length > 0 ? pList.map(pn => {
@@ -4106,12 +4127,12 @@ function renderPeriodDetails(config, presetName) {
const cc = getBlockColorClass(merged);
return `<span class="tl-period-tag ${cc}" data-period-key="${pn}">
${p?.name || pn}
- <button onclick="removePeriodFromDayPlanUI('${presetName}','${name}','${pn}')" class="tl-tag-remove" title="移除">&times;</button>
+ <button onclick="removePeriodFromDayPlanUI('${presetName}','${name}','${pn}')" class="tl-tag-remove" title="${t('common.delete')}">&times;</button>
</span>`;
- }).join('') : '<span class="text-[10px] text-gray-400">空 (全天走 default)</span>'}
+ }).join('') : '<span class="text-[10px] text-gray-400">' + t('tl.emptyDayPlan') + '</span>'}
${availablePeriods.length > 0 ? `
<select class="tl-add-period-select" onchange="if(this.value){addPeriodToDayPlan('${presetName}','${name}',this.value);this.value=''}">
- <option value="">+ 添加</option>
+ <option value="">${t('tl.addPeriod')}</option>
${availablePeriods.map(([k, p]) => `<option value="${k}">${p.name || k}</option>`).join('')}
</select>
` : ''}
@@ -4132,7 +4153,7 @@ function renderPeriodDetails(config, presetName) {
dayPlanKeys.forEach((k, idx) => { planColorMap[k] = planColors[idx % planColors.length]; });
html += `<div class="mt-6">
- <div class="tl-section-title"><i class="fa-solid fa-calendar-days"></i>周映射 (Week Map)</div>
+ <div class="tl-section-title"><i class="fa-solid fa-calendar-days"></i>${t('tl.weekMap')}</div>
<div class="bg-white border border-gray-200 rounded-lg px-3 py-2 space-y-1">`;
for (let d = 1; d <= 7; d++) {
@@ -4142,7 +4163,7 @@ function renderPeriodDetails(config, presetName) {
`<option value="${k}" ${k === plan ? 'selected' : ''}>${k}</option>`
).join('');
html += `<div class="tl-dayplan-row ${rowColor} rounded px-2">
- <div class="tl-dayplan-label">${DAY_NAMES[d-1]}</div>
+ <div class="tl-dayplan-label">${getDayNames()[d-1]}</div>
<select class="tl-weekmap-select"
onchange="onTlWeekMap('${presetName}',${d},this.value)">
${options}
@@ -4152,9 +4173,9 @@ function renderPeriodDetails(config, presetName) {
html += `</div>
<div class="flex gap-2 mt-2">
- <button onclick="tlWeekMapQuick('${presetName}','all_same')" class="tl-quick-btn">全周统一</button>
- <button onclick="tlWeekMapQuick('${presetName}','weekday_same')" class="tl-quick-btn">工作日统一</button>
- <button onclick="tlWeekMapQuick('${presetName}','weekday_weekend')" class="tl-quick-btn">工作日/周末</button>
+ <button onclick="tlWeekMapQuick('${presetName}','all_same')" class="tl-quick-btn">${t('tl.allWeekSame')}</button>
+ <button onclick="tlWeekMapQuick('${presetName}','weekday_same')" class="tl-quick-btn">${t('tl.weekdaySame')}</button>
+ <button onclick="tlWeekMapQuick('${presetName}','weekday_weekend')" class="tl-quick-btn">${t('tl.weekdayWeekend')}</button>
</div>
</div>`;
@@ -4162,19 +4183,19 @@ function renderPeriodDetails(config, presetName) {
if (isCustom) {
const overlapPolicy = (config.overlap && config.overlap.policy) || 'error_on_overlap';
html += `<div class="mt-6">
- <div class="tl-section-title"><i class="fa-solid fa-code-branch"></i>冲突策略 (Overlap)</div>
+ <div class="tl-section-title"><i class="fa-solid fa-code-branch"></i>${t('tl.overlapPolicy')}</div>
<div class="bg-white border border-gray-200 rounded-lg px-3 py-3">
<div class="flex items-center gap-2">
<span class="text-xs text-gray-500">policy:</span>
<select class="text-xs border border-gray-200 rounded px-2 py-1 bg-white"
onchange="onTlCustomOverlapPolicy(this.value)">
- <option value="error_on_overlap" ${overlapPolicy === 'error_on_overlap' ? 'selected' : ''}>error_on_overlap(推荐)</option>
- <option value="last_wins" ${overlapPolicy === 'last_wins' ? 'selected' : ''}>last_wins(后定义优先)</option>
+ <option value="error_on_overlap" ${overlapPolicy === 'error_on_overlap' ? 'selected' : ''}>${t('tl.errorOnOverlap')}</option>
+ <option value="last_wins" ${overlapPolicy === 'last_wins' ? 'selected' : ''}>${t('tl.lastWins')}</option>
</select>
</div>
<div class="text-[10px] text-gray-400 mt-2">
<i class="fa-solid fa-info-circle mr-1"></i>
- <code>error_on_overlap</code> 会在时间段重叠时直接报错;<code>last_wins</code> 会按 day_plans 中靠后的时间段覆盖。
+ ${t('tl.overlapHint')}
</div>
</div>
</div>`;
@@ -4184,12 +4205,12 @@ function renderPeriodDetails(config, presetName) {
if (!isCustom) {
html += `<div class="mt-4 text-xs text-gray-400 p-3 bg-gray-50 rounded-lg border border-gray-200">
<i class="fa-solid fa-lightbulb mr-1 text-amber-400"></i>
- 直接在上方调整开关和下拉框,左侧 YAML 会同步更新。如需更精细的控制,可直接编辑左侧 YAML 或修改 <strong>timeline.yaml</strong>。
+ ${t('tl.presetHint')}
</div>`;
} else {
html += `<div class="mt-4 text-xs text-gray-400 p-3 bg-purple-50 rounded-lg border border-purple-200">
<i class="fa-solid fa-pen-ruler mr-1 text-purple-400"></i>
- 自定义模式支持完全自由编辑。可直接在上方调整控件,或在左侧编辑 YAML 文本,两边实时同步。
+ ${t('tl.customHint')}
</div>`;
}
@@ -4203,9 +4224,9 @@ function renderPeriodDetails(config, presetName) {
*/
function renderBehaviorToggles(cfg, presetName, periodKey, rawCfg = null) {
const toggleItems = [
- { k: 'collect', label: '采集', icon: 'fa-download' },
- { k: 'analyze', label: '分析', icon: 'fa-brain' },
- { k: 'push', label: '推送', icon: 'fa-bell' },
+ { k: 'collect', label: t('tl.collect'), icon: 'fa-download' },
+ { k: 'analyze', label: t('tl.analyze'), icon: 'fa-brain' },
+ { k: 'push', label: t('tl.push'), icon: 'fa-bell' },
];
const uid = `tl-${presetName}-${periodKey}`;
@@ -4235,7 +4256,7 @@ function renderBehaviorToggles(cfg, presetName, periodKey, rawCfg = null) {
// report_mode
html += `<div class="flex items-center gap-1">
- <span class="text-[10px] text-gray-400">报告:</span>
+ <span class="text-[10px] text-gray-400">${t('tl.report')}</span>
<select class="text-[10px] border border-gray-200 rounded px-1 py-0.5 bg-white"
onchange="onTlSelect('${presetName}','${periodKey}','report_mode',this.value)">
${reportModes.map(m => `<option value="${m}" ${cfg.report_mode === m ? 'selected' : ''}>${m}</option>`).join('')}
@@ -4244,7 +4265,7 @@ function renderBehaviorToggles(cfg, presetName, periodKey, rawCfg = null) {
// ai_mode
html += `<div class="flex items-center gap-1">
- <span class="text-[10px] text-gray-400">AI:</span>
+ <span class="text-[10px] text-gray-400">${t('tl.aiMode')}</span>
<select class="text-[10px] border border-gray-200 rounded px-1 py-0.5 bg-white"
onchange="onTlSelect('${presetName}','${periodKey}','ai_mode',this.value)">
${aiModes.map(m => `<option value="${m}" ${(cfg.ai_mode || 'follow_report') === m ? 'selected' : ''}>${m}</option>`).join('')}
@@ -4257,12 +4278,12 @@ function renderBehaviorToggles(cfg, presetName, periodKey, rawCfg = null) {
html += `<label class="flex items-center gap-1 text-[10px] ${onceAnalyze ? 'text-blue-600' : 'text-gray-400'}" style="cursor:pointer">
<input type="checkbox" ${onceAnalyze ? 'checked' : ''}
onchange="onTlToggle('${presetName}','${periodKey}','once.analyze',this.checked)"
- class="w-3 h-3 rounded">仅分析一次
+ class="w-3 h-3 rounded">${t('tl.analyzeOnce')}
</label>`;
html += `<label class="flex items-center gap-1 text-[10px] ${oncePush ? 'text-blue-600' : 'text-gray-400'}" style="cursor:pointer">
<input type="checkbox" ${oncePush ? 'checked' : ''}
onchange="onTlToggle('${presetName}','${periodKey}','once.push',this.checked)"
- class="w-3 h-3 rounded">仅推送一次
+ class="w-3 h-3 rounded">${t('tl.pushOnce')}
</label>`;
html += `</div>`;
@@ -4270,7 +4291,7 @@ function renderBehaviorToggles(cfg, presetName, periodKey, rawCfg = null) {
// 时间段编辑(仅非 default)
if (periodKey !== 'default' && (cfg.start || cfg.end)) {
html += `<div class="flex items-center gap-2 mt-2">
- <span class="text-[10px] text-gray-400">时间:</span>
+ <span class="text-[10px] text-gray-400">${t('tl.time')}</span>
<input type="time" value="${cfg.start || ''}" class="text-xs border border-gray-200 rounded px-1.5 py-0.5"
onchange="onTlSelect('${presetName}','${periodKey}','start',this.value)">
<span class="text-gray-300">~</span>
@@ -4284,36 +4305,35 @@ function renderBehaviorToggles(cfg, presetName, periodKey, rawCfg = null) {
const filterMethod = baseCfg.filter_method || '';
const frequencyFile = baseCfg.frequency_file || '';
const interestsFile = baseCfg.interests_file || '';
- const methodHint = periodKey === 'default' ? '不填则跟随全局 filter.method' : '不填则继承 default(再回退全局)';
+ const methodHint = periodKey === 'default' ? t('tl.filterMethodHint.default') : t('tl.filterMethodHint.period');
html += `<div class="mt-3 pt-3 border-t border-gray-100">
- <div class="text-[10px] uppercase tracking-wider font-bold text-gray-400 mb-2">筛选覆盖(可选)</div>
+ <div class="text-[10px] uppercase tracking-wider font-bold text-gray-400 mb-2">${t('tl.filterOverride')}</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-2">
<div>
<label class="block text-[10px] text-gray-400 mb-1">filter_method</label>
<select class="text-[10px] w-full border border-gray-200 rounded px-1.5 py-1 bg-white"
onchange="onTlOptionalSelect('${presetName}','${periodKey}','filter_method',this.value)">
- <option value="" ${filterMethod === '' ? 'selected' : ''}>继承</option>
+ <option value="" ${filterMethod === '' ? 'selected' : ''}>${t('tl.inherit')}</option>
<option value="keyword" ${filterMethod === 'keyword' ? 'selected' : ''}>keyword</option>
<option value="ai" ${filterMethod === 'ai' ? 'selected' : ''}>ai</option>
</select>
</div>
<div>
<label class="block text-[10px] text-gray-400 mb-1">frequency_file</label>
- <input type="text" value="${frequencyFile}" placeholder="如 tech.txt"
+ <input type="text" value="${frequencyFile}" placeholder="e.g. tech.txt"
class="text-[10px] w-full border border-gray-200 rounded px-1.5 py-1 bg-white"
onchange="onTlOptionalInput('${presetName}','${periodKey}','frequency_file',this.value)">
</div>
<div>
<label class="block text-[10px] text-gray-400 mb-1">interests_file</label>
- <input type="text" value="${interestsFile}" placeholder="如 geopolitics.txt"
+ <input type="text" value="${interestsFile}" placeholder="e.g. geopolitics.txt"
class="text-[10px] w-full border border-gray-200 rounded px-1.5 py-1 bg-white"
onchange="onTlOptionalInput('${presetName}','${periodKey}','interests_file',this.value)">
</div>
</div>
<div class="text-[10px] text-gray-400 mt-2">
- <i class="fa-solid fa-lightbulb mr-1"></i>${methodHint}。<code>frequency_file</code> 从 <code>config/custom/keyword/</code> 查找,
- <code>interests_file</code> 从 <code>config/custom/ai/</code> 查找;留空会删除该字段并恢复继承。
+ <i class="fa-solid fa-lightbulb mr-1"></i>${methodHint}${t('tl.filterFileHint')}
</div>
</div>`;
@@ -4858,7 +4878,7 @@ window.selectTimelinePreset = function(name) {
const tlData = parseTimelineData();
const tlCfg = getPresetConfig(tlData, name);
const displayName = tlCfg?.name || name;
- showToast(`已切换至「${displayName}」模式`, 'success');
+ showToast(t('toast.switchedToMode', displayName), 'success');
}
/**
@@ -4932,7 +4952,7 @@ window.openTlNewPresetModal = function() {
// 填充模板下拉
const sel = document.getElementById('tl-new-preset-template');
const data = parseTimelineData();
- sel.innerHTML = '<option value="">空白模板(仅采集,不推送不分析)</option>';
+ sel.innerHTML = `<option value="">${t('tlModal.emptyTemplate')}</option>`;
if (data?.presets) {
Object.keys(data.presets).forEach(k => {
const name = data.presets[k]?.name || k;
@@ -4940,7 +4960,7 @@ window.openTlNewPresetModal = function() {
});
}
if (data?.custom) {
- sel.innerHTML += `<option value="custom">${data.custom.name || '自定义'} (custom)</option>`;
+ sel.innerHTML += `<option value="custom">${data.custom.name || t('tl.custom')} (custom)</option>`;
}
// 清空输入
document.getElementById('tl-new-preset-key').value = '';
@@ -4961,14 +4981,14 @@ window.confirmTlNewPreset = function() {
const template = document.getElementById('tl-new-preset-template').value;
// 验证
- if (!key) { showToast('请输入模式标识 (key)', 'error'); return; }
- if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key)) { showToast('key 仅支持英文、数字和下划线,且不能以数字开头', 'error'); return; }
- if (!name) { showToast('请输入显示名称', 'error'); return; }
+ if (!key) { showToast(t('toast.enterPresetKey'), 'error'); return; }
+ if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key)) { showToast(t('toast.invalidKey'), 'error'); return; }
+ if (!name) { showToast(t('toast.enterName'), 'error'); return; }
// 检查重复
const data = parseTimelineData();
- if (data?.presets?.[key]) { showToast(`预设「${key}」已存在`, 'error'); return; }
- if (key === 'custom') { showToast('不能使用 "custom" 作为预设名', 'error'); return; }
+ if (data?.presets?.[key]) { showToast(t('toast.presetExists', key), 'error'); return; }
+ if (key === 'custom') { showToast(t('toast.noCustomKey'), 'error'); return; }
// 构建 YAML 文本块
let block;
@@ -5020,7 +5040,7 @@ window.confirmTlNewPreset = function() {
selectTimelinePreset(key);
closeTlNewPresetModal();
- showToast(`调度模式「${name}」创建成功`, 'success');
+ showToast(t('toast.presetCreated', name), 'success');
}
/**
@@ -5092,24 +5112,24 @@ window.confirmTlNewPeriod = function() {
const start = document.getElementById('tl-new-period-start').value;
const end = document.getElementById('tl-new-period-end').value;
- if (!key) { showToast('请输入时间段标识 (key)', 'error'); return; }
- if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key)) { showToast('key 仅支持英文、数字和下划线', 'error'); return; }
- if (!name) { showToast('请输入显示名称', 'error'); return; }
- if (!start || !end) { showToast('请设置开始和结束时间', 'error'); return; }
- if (start === end) { showToast('开始时间和结束时间不能相同', 'error'); return; }
+ if (!key) { showToast(t('toast.enterPeriodKey'), 'error'); return; }
+ if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key)) { showToast(t('toast.invalidKeyFormat'), 'error'); return; }
+ if (!name) { showToast(t('toast.enterPeriodName'), 'error'); return; }
+ if (!start || !end) { showToast(t('toast.setTime'), 'error'); return; }
+ if (start === end) { showToast(t('toast.sameTime'), 'error'); return; }
const data = parseTimelineData();
const presetCfg = getPresetConfig(data, _tlNewPeriodTarget);
- if (presetCfg?.periods?.[key]) { showToast(`时间段「${key}」已存在`, 'error'); return; }
+ if (presetCfg?.periods?.[key]) { showToast(t('toast.periodExists', key), 'error'); return; }
const editor = document.getElementById('timeline-editor');
const lines = editor.value.split('\n');
const sectionInfo = findPresetSection(lines, _tlNewPeriodTarget);
- if (!sectionInfo) { showToast('未找到预设配置段', 'error'); return; }
+ if (!sectionInfo) { showToast(t('toast.presetSectionNotFound'), 'error'); return; }
const periodsLine = findChildKey(lines, sectionInfo.start, sectionInfo.end, sectionInfo.indent, 'periods');
- if (periodsLine < 0) { showToast('未找到 periods 配置段', 'error'); return; }
+ if (periodsLine < 0) { showToast(t('toast.periodsNotFound'), 'error'); return; }
const periodsIndent = lines[periodsLine].search(/\S/);
const periodsContent = lines[periodsLine].trim();
@@ -5144,7 +5164,7 @@ window.confirmTlNewPeriod = function() {
closeTlNewPeriodModal();
syncTimelineToUI();
- showToast(`时间段「${name}」添加成功`, 'success');
+ showToast(t('toast.periodAdded', name), 'success');
}
// ── 删除时间段 ──
@@ -5161,9 +5181,9 @@ window.deleteTlPeriod = function(presetName, periodKey) {
});
const periodName = config.periods?.[periodKey]?.name || periodKey;
- let msg = `确定删除时间段「${periodName}」?`;
+ let msg = t('confirm.deletePeriod', periodName);
if (refs.length > 0) {
- msg += `\n\n⚠️ 该时间段被以下日计划引用,将同时移除引用:\n${refs.map(r => ' • ' + r).join('\n')}`;
+ msg += t('confirm.periodInUse') + refs.map(r => ' • ' + r).join('\n');
}
if (!confirm(msg)) return;
@@ -5195,7 +5215,7 @@ window.deleteTlPeriod = function(presetName, periodKey) {
updateBackdrop('timeline-editor', 'timeline-backdrop');
debounceSaveTimeline();
syncTimelineToUI();
- showToast(`时间段「${periodName}」已删除`, 'success');
+ showToast(t('toast.periodDeleted', periodName), 'success');
}
// ── 复制时间段 ──
@@ -5238,7 +5258,7 @@ window.duplicateTlPeriod = function(presetName, periodKey) {
for (let li = 0; li < copiedLines.length; li++) {
const m = copiedLines[li].match(/^(\s*name:\s*).+$/);
if (m) {
- const newName = (src.name || periodKey) + ' (副本)';
+ const newName = (src.name || periodKey) + ' (' + t('tl.copy') + ')';
copiedLines[li] = `${m[1]}"${newName}"`;
break;
}
@@ -5250,7 +5270,7 @@ window.duplicateTlPeriod = function(presetName, periodKey) {
updateBackdrop('timeline-editor', 'timeline-backdrop');
debounceSaveTimeline();
syncTimelineToUI();
- showToast(`已复制为「${newKey}」`, 'success');
+ showToast(t('toast.duplicatedAs', newKey), 'success');
}
// ── 删除预设模式 ──
@@ -5259,11 +5279,11 @@ const PROTECTED_PRESETS = ['morning_evening', 'always_on', 'office_hours', 'nigh
window.deleteTlPreset = function(presetName) {
if (PROTECTED_PRESETS.includes(presetName)) {
- showToast('内置预设不可删除,可使用复制功能', 'warning');
+ showToast(t('toast.builtinNoDelete'), 'warning');
return;
}
if (presetName === 'custom') {
- showToast('custom 模式不可删除', 'warning');
+ showToast(t('toast.customNoDelete'), 'warning');
return;
}
@@ -5271,7 +5291,7 @@ window.deleteTlPreset = function(presetName) {
const cfg = data?.presets?.[presetName];
const displayName = cfg?.name || presetName;
- if (!confirm(`确定删除调度模式「${displayName}」?\n此操作不可撤销。`)) return;
+ if (!confirm(t('confirm.deletePreset', displayName))) return;
const editor = document.getElementById('timeline-editor');
const lines = editor.value.split('\n');
@@ -5291,7 +5311,7 @@ window.deleteTlPreset = function(presetName) {
} else {
syncTimelineToUI();
}
- showToast(`调度模式「${displayName}」已删除`, 'success');
+ showToast(t('toast.presetDeleted', displayName), 'success');
}
// ── 复制预设模式 ──
@@ -5304,7 +5324,7 @@ window.duplicateTlPreset = function(presetName) {
openTlNewPresetModal();
const origName = src.name || presetName;
document.getElementById('tl-new-preset-key').value = presetName + '_copy';
- document.getElementById('tl-new-preset-name').value = origName + ' (副本)';
+ document.getElementById('tl-new-preset-name').value = origName + ' (' + t('tl.copy') + ')';
document.getElementById('tl-new-preset-desc').value = src.description || '';
document.getElementById('tl-new-preset-template').value = presetName;
}
@@ -5312,17 +5332,17 @@ window.duplicateTlPreset = function(presetName) {
// ── 新增日计划 ──
window.addTlDayPlan = function(presetName) {
- const planKey = prompt('请输入日计划标识 (key),如 holiday:');
+ const planKey = prompt(t('prompt.enterDayPlanKey'));
if (!planKey) return;
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(planKey)) {
- showToast('key 仅支持英文、数字和下划线', 'error');
+ showToast(t('toast.invalidKeyFormat'), 'error');
return;
}
const data = parseTimelineData();
const config = getPresetConfig(data, presetName);
if (config?.day_plans?.[planKey]) {
- showToast(`日计划「${planKey}」已存在`, 'error');
+ showToast(t('toast.dayPlanExists', planKey), 'error');
return;
}
@@ -5351,7 +5371,7 @@ window.addTlDayPlan = function(presetName) {
updateBackdrop('timeline-editor', 'timeline-backdrop');
debounceSaveTimeline();
syncTimelineToUI();
- showToast(`日计划「${planKey}」已添加`, 'success');
+ showToast(t('toast.dayPlanAdded', planKey), 'success');
}
// ── 删除日计划 ──
@@ -5365,15 +5385,15 @@ window.deleteTlDayPlan = function(presetName, planKey) {
const refs = [];
for (let d = 1; d <= 7; d++) {
const v = weekMap[d] || weekMap[String(d)];
- if (v === planKey) refs.push(DAY_NAMES[d - 1]);
+ if (v === planKey) refs.push(getDayNames()[d - 1]);
}
if (refs.length > 0) {
- showToast(`无法删除:「${planKey}」正在被 ${refs.join('、')} 使用。请先修改周映射。`, 'error');
+ showToast(t('toast.cannotDeleteDayPlan', [planKey, refs.join(', ')]), 'error');
return;
}
- if (!confirm(`确定删除日计划「${planKey}」?`)) return;
+ if (!confirm(t('confirm.deleteDayPlan', planKey))) return;
const editor = document.getElementById('timeline-editor');
const lines = editor.value.split('\n');
@@ -5399,7 +5419,7 @@ window.deleteTlDayPlan = function(presetName, planKey) {
updateBackdrop('timeline-editor', 'timeline-backdrop');
debounceSaveTimeline();
syncTimelineToUI();
- showToast(`日计划「${planKey}」已删除`, 'success');
+ showToast(t('toast.dayPlanDeleted', planKey), 'success');
}
// ── 日计划中添加/移除时间段引用 ──
@@ -5476,7 +5496,7 @@ window.tlWeekMapQuick = function(presetName, mode) {
if (!config) return;
const dayPlanKeys = Object.keys(config.day_plans || {});
- if (dayPlanKeys.length === 0) { showToast('没有可用的日计划', 'error'); return; }
+ if (dayPlanKeys.length === 0) { showToast(t('toast.noDayPlans'), 'error'); return; }
let mapping = {};
@@ -5490,7 +5510,7 @@ window.tlWeekMapQuick = function(presetName, mode) {
mapping[6] = wm[6] || wm['6'] || plan;
mapping[7] = wm[7] || wm['7'] || plan;
} else if (mode === 'weekday_weekend') {
- if (dayPlanKeys.length < 2) { showToast('需要至少两个日计划来分离工作日/周末', 'warning'); return; }
+ if (dayPlanKeys.length < 2) { showToast(t('toast.needTwoDayPlans'), 'warning'); return; }
const wd = dayPlanKeys[0];
const we = dayPlanKeys[1];
for (let d = 1; d <= 5; d++) mapping[d] = wd;
@@ -5501,7 +5521,7 @@ window.tlWeekMapQuick = function(presetName, mode) {
for (let d = 1; d <= 7; d++) {
if (mapping[d]) onTlWeekMap(presetName, d, mapping[d]);
}
- showToast('周映射已更新', 'success');
+ showToast(t('toast.weekMapUpdated'), 'success');
}
// ── 辅助函数 ──
@@ -5723,14 +5743,14 @@ window.onTlBarClick = function(event, presetName, dayNum) {
if (!config) return;
const weekMap = config.week_map || {};
- const planKey = weekMap[dayNum] || weekMap[String(dayNum)] || '(未设置)';
+ const planKey = weekMap[dayNum] || weekMap[String(dayNum)] || t('tl.notSet');
hideTlTooltip();
const el = document.createElement('div');
el.className = 'tl-tooltip';
- el.innerHTML = `<div style="font-weight:700;margin-bottom:2px">${DAY_NAMES[dayNum - 1]}</div>
- <div style="font-size:11px;color:#9ca3af">日计划: <strong style="color:#374151">${planKey}</strong></div>
- <div style="font-size:10px;color:#9ca3af;margin-top:4px">使用 default 配置</div>`;
+ el.innerHTML = `<div style="font-weight:700;margin-bottom:2px">${getDayNames()[dayNum - 1]}</div>
+ <div style="font-size:11px;color:#9ca3af">${t('tl.dayPlanLabel')} <strong style="color:#374151">${planKey}</strong></div>
+ <div style="font-size:10px;color:#9ca3af;margin-top:4px">${t('tl.usesDefault')}</div>`;
document.body.appendChild(el);
tlTooltipEl = el;
@@ -5829,5 +5849,5 @@ function toggleSupportSidebar() {
const btn = document.getElementById('sidebar-toggle-btn');
const isCollapsed = wrap.classList.toggle('collapsed');
btn.classList.toggle('is-collapsed', isCollapsed);
- btn.title = isCollapsed ? '展开侧栏' : '收起侧栏';
+ btn.title = isCollapsed ? t('sidebar.expand') : t('sidebar.collapse');
}
diff --git a/docs/index.html b/docs/index.html
index 64f07b4a91..35a7b4d85e 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -22,21 +22,26 @@
<div class="max-w-full mx-auto px-4 sm:px-6 lg:px-8 h-14 flex items-center justify-between">
<a href="https://github.com/sansan0/TrendRadar" target="_blank" class="flex items-center gap-3 hover:opacity-80 transition-opacity">
<i class="fa-solid fa-sliders text-blue-600 text-lg"></i>
- <span class="font-bold text-lg tracking-tight text-gray-900">TrendRadar <span class="text-gray-500 text-xs font-normal ml-2">可视化配置编辑器 </span></span>
+ <span class="font-bold text-lg tracking-tight text-gray-900">TrendRadar <span class="text-gray-500 text-xs font-normal ml-2" data-i18n="nav.subtitle">可视化配置编辑器 </span></span>
</a>
<!-- 隐私安全提示 -->
<div class="hidden lg:flex items-center text-xs text-gray-500 bg-gray-50 px-3 py-1.5 rounded-full border border-gray-100 select-none">
<i class="fa-solid fa-shield-halved mr-1.5 text-green-500"></i>
- <span>纯静态页面,数据仅保存在你的本地浏览器,请放心使用</span>
+ <span data-i18n="nav.privacy">纯静态页面,数据仅保存在你的本地浏览器,请放心使用</span>
</div>
- <div class="flex gap-3">
+ <div class="flex items-center gap-3">
+ <!-- 中英文切换 -->
+ <button id="lang-toggle-btn" onclick="switchLang(getLang()==='zh'?'en':'zh')" class="flex items-center gap-1.5 text-xs font-semibold text-gray-600 hover:text-blue-600 hover:bg-blue-50 px-2.5 py-1.5 rounded-md border border-gray-200 transition-colors select-none" title="切换到 English">
+ <i class="fa-solid fa-globe text-gray-400"></i>
+ <span id="lang-toggle-label">EN</span>
+ </button>
<button onclick="openLoadConfigModal()" class="text-xs text-blue-600 hover:text-blue-800 underline flex items-center gap-1">
- <i class="fa-solid fa-cloud-arrow-down"></i>加载官网最新配置
+ <i class="fa-solid fa-cloud-arrow-down"></i><span data-i18n="nav.loadLatest">加载官网最新配置</span>
</button>
<button onclick="copyResult()" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-1.5 rounded text-sm font-medium transition-colors shadow-sm">
- <i class="fa-regular fa-copy mr-1.5"></i>复制配置
+ <i class="fa-regular fa-copy mr-1.5"></i><span data-i18n="nav.copyConfig">复制配置</span>
</button>
</div>
</div>
@@ -62,18 +67,18 @@
<!-- 保存时间显示 -->
<div id="save-time-config" class="save-time-badge px-3 text-[10px] text-gray-500 flex items-center gap-1">
<i class="fa-regular fa-clock"></i>
- <span id="config-save-label" class="hidden">已保存: </span>
- <span id="config-save-time" class="text-gray-400" title="未保存">未保存</span>
+ <span id="config-save-label" class="hidden" data-i18n="save.saved">已保存: </span>
+ <span id="config-save-time" class="text-gray-400" title="未保存" data-i18n="save.notSaved">未保存</span>
</div>
<div id="save-time-frequency" class="save-time-badge hidden px-3 text-[10px] text-gray-500 flex items-center gap-1">
<i class="fa-regular fa-clock"></i>
- <span id="frequency-save-label" class="hidden">已保存: </span>
- <span id="frequency-save-time" class="text-gray-400" title="未保存">未保存</span>
+ <span id="frequency-save-label" class="hidden" data-i18n="save.saved">已保存: </span>
+ <span id="frequency-save-time" class="text-gray-400" title="未保存" data-i18n="save.notSaved">未保存</span>
</div>
<div id="save-time-timeline" class="save-time-badge hidden px-3 text-[10px] text-gray-500 flex items-center gap-1">
<i class="fa-regular fa-clock"></i>
- <span id="timeline-save-label" class="hidden">已保存: </span>
- <span id="timeline-save-time" class="text-gray-400" title="未保存">未保存</span>
+ <span id="timeline-save-label" class="hidden" data-i18n="save.saved">已保存: </span>
+ <span id="timeline-save-time" class="text-gray-400" title="未保存" data-i18n="save.notSaved">未保存</span>
</div>
</div>
@@ -102,10 +107,10 @@
<div class="flex-1 flex flex-col bg-gray-50 min-w-0">
<div class="flex items-center justify-between px-6 py-3 bg-white border-b border-gray-200">
<div class="flex items-center gap-3">
- <span class="text-sm font-bold text-gray-700"><i class="fa-solid fa-list-check mr-2"></i><span id="right-panel-title">配置模块</span></span>
+ <span class="text-sm font-bold text-gray-700"><i class="fa-solid fa-list-check mr-2"></i><span id="right-panel-title" data-i18n="panel.configModules">配置模块</span></span>
<button id="version-check-btn" onclick="checkVersion()" class="text-xs bg-indigo-500 hover:bg-indigo-600 text-white px-3 py-1 rounded shadow-sm transition-all flex items-center gap-1.5" title="检测 config.yaml 版本">
<i class="fa-solid fa-code-compare"></i>
- <span>版本检测</span>
+ <span data-i18n="panel.versionCheck">版本检测</span>
</button>
<button onclick="resetToDefault()" class="text-xs text-gray-400 hover:text-red-500 transition-colors px-2 py-1" title="重置当前内容为默认状态">
<i class="fa-solid fa-rotate-left"></i>
@@ -143,9 +148,9 @@
<div class="w-6 h-6 bg-gradient-to-br from-orange-400 to-pink-500 rounded-lg flex items-center justify-center">
<i class="fa-solid fa-heart text-white text-[10px]"></i>
</div>
- <span class="text-sm font-bold text-gray-700 tracking-tight">支持项目</span>
+ <span class="text-sm font-bold text-gray-700 tracking-tight" data-i18n="sidebar.title">支持项目</span>
</div>
- <p class="sidebar-quote text-[10px] text-gray-400 mt-1.5 leading-relaxed italic">若 TrendRadar 曾为你捕捉价值,不妨为它注入动力,助其持续进化</p>
+ <p class="sidebar-quote text-[10px] text-gray-400 mt-1.5 leading-relaxed italic" data-i18n="sidebar.quote">若 TrendRadar 曾为你捕捉价值,不妨为它注入动力,助其持续进化</p>
</div>
<!-- 卡片列表 -->
@@ -158,12 +163,12 @@
<i class="fa-solid fa-star"></i>
</div>
<div class="min-w-0">
- <div class="text-xs font-bold text-gray-800 leading-tight">点亮 Star</div>
- <div class="text-[10px] text-gray-400 leading-tight mt-0.5">让更多人发现它</div>
+ <div class="text-xs font-bold text-gray-800 leading-tight" data-i18n="sidebar.star">点亮 Star</div>
+ <div class="text-[10px] text-gray-400 leading-tight mt-0.5" data-i18n="sidebar.starDesc">让更多人发现它</div>
</div>
</div>
<div class="sidebar-cta bg-gradient-to-r from-orange-400 to-red-500 text-white group-hover:from-orange-500 group-hover:to-red-600 shadow-sm group-hover:shadow-md">
- <i class="fa-brands fa-github mr-1"></i>前往 GitHub
+ <i class="fa-brands fa-github mr-1"></i><span data-i18n="sidebar.goGithub">前往 GitHub</span>
</div>
</a>
@@ -174,8 +179,8 @@
<i class="fa-brands fa-weixin"></i>
</div>
<div class="min-w-0">
- <div class="text-xs font-bold text-gray-800 leading-tight">不迷路</div>
- <div class="text-[10px] text-gray-400 leading-tight mt-0.5">获取更新通知</div>
+ <div class="text-xs font-bold text-gray-800 leading-tight" data-i18n="sidebar.follow">不迷路</div>
+ <div class="text-[10px] text-gray-400 leading-tight mt-0.5" data-i18n="sidebar.followDesc">获取更新通知</div>
</div>
</div>
<div class="flex justify-center relative">
@@ -183,10 +188,10 @@
<img src="./assets/weixin.webp" alt="微信公众号" class="w-full h-full object-contain">
</div>
<div class="sidebar-enlarge-hint">
- <i class="fa-solid fa-expand mr-1"></i>点击放大
+ <i class="fa-solid fa-expand mr-1"></i><span data-i18n="sidebar.clickEnlarge">点击放大</span>
</div>
</div>
- <p class="text-[10px] text-gray-400 text-center mt-2">扫码关注公众号</p>
+ <p class="text-[10px] text-gray-400 text-center mt-2" data-i18n="sidebar.scanFollow">扫码关注公众号</p>
</div>
<!-- 03: 随心赞赏 -->
@@ -196,8 +201,8 @@
<i class="fa-solid fa-hand-holding-heart"></i>
</div>
<div class="min-w-0">
- <div class="text-xs font-bold text-gray-800 leading-tight">随心赞赏</div>
- <div class="text-[10px] text-gray-400 leading-tight mt-0.5">1 元也是鼓励</div>
+ <div class="text-xs font-bold text-gray-800 leading-tight" data-i18n="sidebar.donate">随心赞赏</div>
+ <div class="text-[10px] text-gray-400 leading-tight mt-0.5" data-i18n="sidebar.donateDesc">1 元也是鼓励</div>
</div>
</div>
<div class="flex justify-center relative">
@@ -205,10 +210,10 @@
<img src="https://cdn-1258574687.cos.ap-shanghai.myqcloud.com/img/%2F2026%2F01%2F18ecce7c224ce0ea4c59394c29e408f8-e0d1db45.webp" alt="微信支付" class="w-full h-full object-contain">
</div>
<div class="sidebar-enlarge-hint">
- <i class="fa-solid fa-expand mr-1"></i>点击放大
+ <i class="fa-solid fa-expand mr-1"></i><span data-i18n="sidebar.clickEnlarge">点击放大</span>
</div>
</div>
- <p class="text-[10px] text-gray-400 text-center mt-2">微信扫码 · 丰俭由人</p>
+ <p class="text-[10px] text-gray-400 text-center mt-2" data-i18n="sidebar.scanDonate">微信扫码 · 丰俭由人</p>
</div>
<!-- 04: 探索更多 -->
@@ -218,19 +223,19 @@
<i class="fa-solid fa-map-location-dot"></i>
</div>
<div class="min-w-0">
- <div class="text-xs font-bold text-gray-800 leading-tight">探索更多</div>
- <div class="text-[10px] text-gray-400 leading-tight mt-0.5">另一个用心的作品</div>
+ <div class="text-xs font-bold text-gray-800 leading-tight" data-i18n="sidebar.explore">探索更多</div>
+ <div class="text-[10px] text-gray-400 leading-tight mt-0.5" data-i18n="sidebar.exploreDesc">另一个用心的作品</div>
</div>
</div>
<div class="sidebar-cta bg-red-50 text-red-600 border border-red-100 group-hover:bg-red-100 group-hover:text-red-700">
- <i class="fa-solid fa-arrow-up-right-from-square mr-1"></i>去看看
+ <i class="fa-solid fa-arrow-up-right-from-square mr-1"></i><span data-i18n="sidebar.goExplore">去看看</span>
</div>
</a>
</div>
<!-- 底部寄语 -->
<div class="px-3 py-2.5 border-t border-gray-100 bg-white/60">
- <p class="text-[10px] text-gray-300 text-center italic font-serif tracking-wide">"开源不易,感谢支持"</p>
+ <p class="text-[10px] text-gray-300 text-center italic font-serif tracking-wide" data-i18n="sidebar.footer">"开源不易,感谢支持"</p>
</div>
</div>
</div>
@@ -241,25 +246,25 @@
<div id="rss-modal" class="modal-overlay hidden">
<div class="modal-content">
<div class="flex items-center justify-between mb-4">
- <h3 class="text-lg font-bold text-gray-800"><i class="fa-solid fa-rss mr-2 text-orange-500"></i>添加 RSS 源</h3>
+ <h3 class="text-lg font-bold text-gray-800"><i class="fa-solid fa-rss mr-2 text-orange-500"></i><span data-i18n="rssModal.addTitle">添加 RSS 源</span></h3>
<button onclick="closeRssModal()" class="text-gray-400 hover:text-gray-600"><i class="fa-solid fa-times text-xl"></i></button>
</div>
<div class="space-y-4">
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">源 ID(唯一标识,英文)</label>
- <input type="text" id="rss-id" placeholder="例如: my-blog" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="rssModal.idLabel">源 ID(唯一标识,英文)</label>
+ <input type="text" id="rss-id" placeholder="例如: my-blog" data-i18n-placeholder="rssModal.idPlaceholder" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
</div>
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">显示名称</label>
- <input type="text" id="rss-name" placeholder="例如: 我的博客" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="rssModal.nameLabel">显示名称</label>
+ <input type="text" id="rss-name" placeholder="例如: 我的博客" data-i18n-placeholder="rssModal.namePlaceholder" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
</div>
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">RSS URL</label>
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="rssModal.urlLabel">RSS URL</label>
<input type="text" id="rss-url" placeholder="https://example.com/feed.xml" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
</div>
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">最大文章年龄(天,可选)</label>
- <input type="number" id="rss-max-age" placeholder="留空使用全局设置" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="rssModal.maxAgeLabel">最大文章年龄(天,可选)</label>
+ <input type="number" id="rss-max-age" placeholder="留空使用全局设置" data-i18n-placeholder="rssModal.maxAgePlaceholder" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
</div>
</div>
@@ -267,7 +272,7 @@
<div class="mt-5 border-t border-gray-100 pt-4">
<button type="button" onclick="toggleRssTips()" class="w-full flex items-center justify-between text-xs text-orange-600 hover:text-orange-700 bg-orange-50 hover:bg-orange-100 px-3 py-2 rounded-lg transition-all group">
<span class="font-bold flex items-center gap-1.5">
- <i class="fa-regular fa-lightbulb"></i> RSS 订阅灵感 & 参考库 <span class="font-normal opacity-70 ml-1">(内附常用源)</span>
+ <i class="fa-regular fa-lightbulb"></i> <span data-i18n="rssModal.tipsTitle">RSS 订阅灵感 & 参考库</span> <span class="font-normal opacity-70 ml-1" data-i18n="rssModal.tipsHasFeeds">(内附常用源)</span>
</span>
<i id="rss-tips-icon" class="fa-solid fa-chevron-down transition-transform duration-200 text-orange-400 group-hover:text-orange-600" style="transform: rotate(180deg);"></i>
</button>
@@ -278,7 +283,7 @@
<div class="bg-white border border-gray-100 rounded-lg p-3 shadow-sm">
<div class="flex items-center gap-2 mb-2">
<i class="fa-brands fa-microsoft text-blue-500"></i>
- <span class="font-bold text-gray-700">Bing 新闻 (支持任意关键词)</span>
+ <span class="font-bold text-gray-700" data-i18n="rssModal.bingNews">Bing 新闻 (支持任意关键词)</span>
</div>
<div class="grid grid-cols-2 gap-2 mb-2">
<button onclick="fillRssUrl('https://www.bing.com/news/search?q=科技+编程&format=RSS')" class="text-left text-[10px] border border-gray-200 hover:border-blue-400 hover:bg-blue-50 hover:text-blue-600 rounded px-2 py-1.5 transition-colors truncate" title="点击填入">
@@ -304,7 +309,7 @@
<div class="bg-white border border-gray-100 rounded-lg p-3 shadow-sm">
<div class="flex items-center gap-2 mb-2">
<i class="fa-solid fa-book-open text-purple-500"></i>
- <span class="font-bold text-gray-700">更多 RSS 源参考</span>
+ <span class="font-bold text-gray-700" data-i18n="rssModal.moreRef">更多 RSS 源参考</span>
</div>
<div class="flex flex-wrap gap-2 text-xs">
<a href="https://github.com/tuan3w/awesome-tech-rss" target="_blank" class="text-blue-600 hover:underline flex items-center bg-blue-50 px-2 py-1 rounded">
@@ -318,14 +323,14 @@
<!-- 免责声明 -->
<div class="text-[10px] text-gray-400 italic leading-relaxed px-1">
- <i class="fa-solid fa-shield-halved mr-1 text-gray-300"></i>免责声明:以上 RSS 示例及第三方工具均源自互联网,开发者未一一验证其长期有效性,请你在使用前自行核实。
+ <i class="fa-solid fa-shield-halved mr-1 text-gray-300"></i><span data-i18n="rssModal.disclaimer">免责声明:以上 RSS 示例及第三方工具均源自互联网,开发者未一一验证其长期有效性,请你在使用前自行核实。</span>
</div>
</div>
</div>
<div class="flex justify-end gap-2 mt-6">
- <button onclick="closeRssModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg">取消</button>
- <button onclick="confirmAddRss()" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700">添加</button>
+ <button onclick="closeRssModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg" data-i18n="common.cancel">取消</button>
+ <button onclick="confirmAddRss()" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700" data-i18n="common.add">添加</button>
</div>
</div>
</div>
@@ -334,17 +339,17 @@
<div id="platform-modal" class="modal-overlay hidden">
<div class="modal-content">
<div class="flex items-center justify-between mb-4">
- <h3 class="text-lg font-bold text-gray-800"><i class="fa-solid fa-layer-group mr-2 text-green-600"></i>添加热榜平台</h3>
+ <h3 class="text-lg font-bold text-gray-800"><i class="fa-solid fa-layer-group mr-2 text-green-600"></i><span data-i18n="platModal.title">添加热榜平台</span></h3>
<button onclick="closePlatformModal()" class="text-gray-400 hover:text-gray-600"><i class="fa-solid fa-times text-xl"></i></button>
</div>
<!-- 标签页切换 -->
<div class="flex border-b border-gray-200 mb-4">
<button onclick="switchPlatformTab('select')" id="tab-platform-select" class="flex-1 py-2 text-sm font-bold text-blue-600 border-b-2 border-blue-600 transition-colors">
- <i class="fa-solid fa-list mr-1"></i>选择预设
+ <i class="fa-solid fa-list mr-1"></i><span data-i18n="platModal.selectPreset">选择预设</span>
</button>
<button onclick="switchPlatformTab('custom')" id="tab-platform-custom" class="flex-1 py-2 text-sm font-bold text-gray-500 border-b-2 border-transparent hover:text-gray-700 transition-colors">
- <i class="fa-solid fa-pen-to-square mr-1"></i>手动输入
+ <i class="fa-solid fa-pen-to-square mr-1"></i><span data-i18n="platModal.manualInput">手动输入</span>
</button>
</div>
@@ -354,28 +359,28 @@
<!-- 动态生成可用平台 -->
</div>
<div id="no-platforms-tip" class="hidden text-center py-6 text-gray-500 text-sm bg-gray-50 rounded">
- <i class="fa-solid fa-check-circle text-green-500 mr-2"></i>所有预设平台已添加
+ <i class="fa-solid fa-check-circle text-green-500 mr-2"></i><span data-i18n="platModal.allAdded">所有预设平台已添加</span>
</div>
</div>
<!-- 2. 手动输入平台 -->
<div id="platform-custom-panel" class="hidden space-y-4">
<div class="bg-blue-50 border border-blue-100 rounded p-3 mb-3 text-xs text-blue-800">
- <i class="fa-solid fa-info-circle mr-1"></i>自定义平台需要后端爬虫支持,此处仅用于配置占位。
+ <i class="fa-solid fa-info-circle mr-1"></i><span data-i18n="platModal.customNote">自定义平台需要后端爬虫支持,此处仅用于配置占位。</span>
</div>
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">平台 Key(英文)</label>
- <input type="text" id="custom-platform-key" placeholder="例如: sspai" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="platModal.keyLabel">平台 Key(英文)</label>
+ <input type="text" id="custom-platform-key" placeholder="例如: sspai" data-i18n-placeholder="platModal.keyPlaceholder" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
</div>
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">显示名称</label>
- <input type="text" id="custom-platform-name" placeholder="例如: 少数派" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="platModal.nameLabel">显示名称</label>
+ <input type="text" id="custom-platform-name" placeholder="例如: 少数派" data-i18n-placeholder="platModal.namePlaceholder" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
</div>
</div>
<div class="flex justify-end gap-2 mt-6">
- <button onclick="closePlatformModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg">取消</button>
- <button onclick="confirmAddPlatform()" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700">添加</button>
+ <button onclick="closePlatformModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg" data-i18n="common.cancel">取消</button>
+ <button onclick="confirmAddPlatform()" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700" data-i18n="common.add">添加</button>
</div>
</div>
</div>
@@ -384,15 +389,15 @@
<div id="wordgroup-type-modal" class="modal-overlay hidden">
<div class="modal-content max-w-2xl">
<div class="flex items-center justify-between mb-4">
- <h3 class="text-lg font-bold text-gray-800"><i class="fa-solid fa-layer-group mr-2 text-blue-500"></i>选择词组类型</h3>
+ <h3 class="text-lg font-bold text-gray-800"><i class="fa-solid fa-layer-group mr-2 text-blue-500"></i><span data-i18n="wgModal.title">选择词组类型</span></h3>
<button onclick="closeWordGroupTypeModal()" class="text-gray-400 hover:text-gray-600"><i class="fa-solid fa-times text-xl"></i></button>
</div>
<div class="space-y-3">
<!-- 组别名类型 -->
<div onclick="confirmAddWordGroup('group')" class="cursor-pointer border-2 border-orange-200 bg-orange-50 rounded-lg p-4 hover:border-orange-400 hover:bg-orange-100 transition-all">
<div class="flex items-center gap-3">
- <span class="text-xs bg-orange-500 text-white px-2 py-1 rounded font-bold">组别名</span>
- <span class="font-bold text-gray-800">多关键词词组(推荐)</span>
+ <span class="text-xs bg-orange-500 text-white px-2 py-1 rounded font-bold" data-i18n="wgModal.groupAlias">组别名</span>
+ <span class="font-bold text-gray-800" data-i18n="wgModal.groupAliasDesc">多关键词词组(推荐)</span>
</div>
<div class="mt-2 text-sm text-gray-600">
<div class="font-mono bg-white rounded p-2 text-xs border border-orange-200">
@@ -402,30 +407,30 @@
<div>朝鲜</div>
</div>
<div class="mt-2 text-xs text-gray-500">
- <i class="fa-solid fa-check-circle text-orange-500 mr-1"></i>适用于:多个关键词归为一组,统一显示为组名
+ <i class="fa-solid fa-check-circle text-orange-500 mr-1"></i><span data-i18n="wgModal.groupAliasUse">适用于:多个关键词归为一组,统一显示为组名</span>
</div>
</div>
</div>
<!-- 单个别名类型 -->
<div onclick="confirmAddWordGroup('alias')" class="cursor-pointer border-2 border-teal-200 bg-teal-50 rounded-lg p-4 hover:border-teal-400 hover:bg-teal-100 transition-all">
<div class="flex items-center gap-3">
- <span class="text-xs bg-teal-500 text-white px-2 py-1 rounded font-bold">单个别名</span>
- <span class="font-bold text-gray-800">正则/关键词 + 别名</span>
+ <span class="text-xs bg-teal-500 text-white px-2 py-1 rounded font-bold" data-i18n="wgModal.singleAlias">单个别名</span>
+ <span class="font-bold text-gray-800" data-i18n="wgModal.singleAliasDesc">正则/关键词 + 别名</span>
</div>
<div class="mt-2 text-sm text-gray-600">
<div class="font-mono bg-white rounded p-2 text-xs border border-teal-200">
<div>/胖东来|于东来/ <span class="text-teal-600">=></span> 胖东来</div>
</div>
<div class="mt-2 text-xs text-gray-500">
- <i class="fa-solid fa-check-circle text-teal-500 mr-1"></i>适用于:用正则匹配多个词,显示为一个别名(前后有空行分隔)
+ <i class="fa-solid fa-check-circle text-teal-500 mr-1"></i><span data-i18n="wgModal.singleAliasUse">适用于:用正则匹配多个词,显示为一个别名(前后有空行分隔)</span>
</div>
</div>
</div>
<!-- 连续别名类型 -->
<div onclick="confirmAddWordGroup('multi-alias')" class="cursor-pointer border-2 border-purple-200 bg-purple-50 rounded-lg p-4 hover:border-purple-400 hover:bg-purple-100 transition-all">
<div class="flex items-center gap-3">
- <span class="text-xs bg-purple-500 text-white px-2 py-1 rounded font-bold">连续别名组</span>
- <span class="font-bold text-gray-800">多个相关品牌/词组</span>
+ <span class="text-xs bg-purple-500 text-white px-2 py-1 rounded font-bold" data-i18n="wgModal.multiAlias">连续别名组</span>
+ <span class="font-bold text-gray-800" data-i18n="wgModal.multiAliasDesc">多个相关品牌/词组</span>
</div>
<div class="mt-2 text-sm text-gray-600">
<div class="font-mono bg-white rounded p-2 text-xs border border-purple-200">
@@ -433,28 +438,28 @@
<div>/众擎|EngineAI/ <span class="text-purple-600">=></span> 众擎机器人</div>
</div>
<div class="mt-2 text-xs text-gray-500">
- <i class="fa-solid fa-check-circle text-purple-500 mr-1"></i>适用于:多个相关品牌放在一起(<strong>无空行分隔</strong>)
+ <i class="fa-solid fa-check-circle text-purple-500 mr-1"></i><span data-i18n="wgModal.multiAliasUse">适用于:多个相关品牌放在一起(<strong>无空行分隔</strong>)</span>
</div>
</div>
</div>
<!-- 普通词组类型 -->
<div onclick="confirmAddWordGroup('plain')" class="cursor-pointer border-2 border-gray-200 bg-gray-50 rounded-lg p-4 hover:border-gray-400 hover:bg-gray-100 transition-all">
<div class="flex items-center gap-3">
- <span class="text-xs bg-gray-500 text-white px-2 py-1 rounded font-bold">普通词组</span>
- <span class="font-bold text-gray-800">简单关键词</span>
+ <span class="text-xs bg-gray-500 text-white px-2 py-1 rounded font-bold" data-i18n="wgModal.plain">普通词组</span>
+ <span class="font-bold text-gray-800" data-i18n="wgModal.plainDesc">简单关键词</span>
</div>
<div class="mt-2 text-sm text-gray-600">
<div class="font-mono bg-white rounded p-2 text-xs border border-gray-200">
<div>申奥</div>
</div>
<div class="mt-2 text-xs text-gray-500">
- <i class="fa-solid fa-check-circle text-gray-500 mr-1"></i>适用于:单个或少量普通关键词
+ <i class="fa-solid fa-check-circle text-gray-500 mr-1"></i><span data-i18n="wgModal.plainUse">适用于:单个或少量普通关键词</span>
</div>
</div>
</div>
</div>
<div class="flex justify-end gap-2 mt-6">
- <button onclick="closeWordGroupTypeModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg">取消</button>
+ <button onclick="closeWordGroupTypeModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg" data-i18n="common.cancel">取消</button>
</div>
</div>
</div>
@@ -487,25 +492,25 @@
<div id="tl-new-preset-modal" class="modal-overlay hidden">
<div class="modal-content">
<div class="flex items-center justify-between mb-4">
- <h3 class="text-lg font-bold text-gray-800"><i class="fa-solid fa-calendar-plus mr-2 text-purple-600"></i>新建调度模式</h3>
+ <h3 class="text-lg font-bold text-gray-800"><i class="fa-solid fa-calendar-plus mr-2 text-purple-600"></i><span data-i18n="tlModal.newPreset">新建调度模式</span></h3>
<button onclick="closeTlNewPresetModal()" class="text-gray-400 hover:text-gray-600"><i class="fa-solid fa-times text-xl"></i></button>
</div>
<div class="space-y-4">
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">模式标识 (key)</label>
- <input type="text" id="tl-new-preset-key" placeholder="英文标识,如 my_schedule" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 text-sm">
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="tlModal.presetKeyLabel">模式标识 (key)</label>
+ <input type="text" id="tl-new-preset-key" placeholder="英文标识,如 my_schedule" data-i18n-placeholder="tlModal.presetKeyPlaceholder" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 text-sm">
<p class="text-[10px] text-gray-400 mt-1">仅支持英文、数字和下划线,将作为 YAML 中的 key</p>
</div>
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">显示名称</label>
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="tlModal.nameLabel">显示名称</label>
<input type="text" id="tl-new-preset-name" placeholder="如:我的调度" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 text-sm">
</div>
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">描述(可选)</label>
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="tlModal.descLabel">描述(可选)</label>
<input type="text" id="tl-new-preset-desc" placeholder="简短描述此模式的用途" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 text-sm">
</div>
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">基于模板</label>
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="tlModal.templateLabel">基于模板</label>
<select id="tl-new-preset-template" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 text-sm">
<option value="">空白模板(仅采集,不推送不分析)</option>
</select>
@@ -513,8 +518,8 @@
</div>
</div>
<div class="flex justify-end gap-2 mt-6">
- <button onclick="closeTlNewPresetModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg">取消</button>
- <button onclick="confirmTlNewPreset()" class="px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700">创建</button>
+ <button onclick="closeTlNewPresetModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg" data-i18n="common.cancel">取消</button>
+ <button onclick="confirmTlNewPreset()" class="px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700" data-i18n="tlModal.create">创建</button>
</div>
</div>
</div>
@@ -523,40 +528,41 @@
<div id="tl-new-period-modal" class="modal-overlay hidden">
<div class="modal-content">
<div class="flex items-center justify-between mb-4">
- <h3 class="text-lg font-bold text-gray-800"><i class="fa-solid fa-clock-rotate-left mr-2 text-blue-600"></i>新增时间段</h3>
+ <h3 class="text-lg font-bold text-gray-800"><i class="fa-solid fa-clock-rotate-left mr-2 text-blue-600"></i><span data-i18n="tlModal.newPeriod">新增时间段</span></h3>
<button onclick="closeTlNewPeriodModal()" class="text-gray-400 hover:text-gray-600"><i class="fa-solid fa-times text-xl"></i></button>
</div>
<div class="space-y-4">
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">时间段标识 (key)</label>
- <input type="text" id="tl-new-period-key" placeholder="英文标识,如 morning_push" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm">
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="tlModal.periodKeyLabel">时间段标识 (key)</label>
+ <input type="text" id="tl-new-period-key" placeholder="英文标识,如 morning_push" data-i18n-placeholder="tlModal.periodKeyPlaceholder" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm">
<p class="text-[10px] text-gray-400 mt-1">仅支持英文、数字和下划线</p>
</div>
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">显示名称</label>
- <input type="text" id="tl-new-period-name" placeholder="如:晨间推送" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm">
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="tlModal.nameLabel">显示名称</label>
+ <input type="text" id="tl-new-period-name" placeholder="如:晨间推送" data-i18n-placeholder="tlModal.periodNamePlaceholder" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm">
</div>
<div class="grid grid-cols-2 gap-4">
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">开始时间</label>
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="tlModal.startTime">开始时间</label>
<input type="time" id="tl-new-period-start" value="09:00" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm">
</div>
<div>
- <label class="block text-xs font-bold text-gray-600 mb-1">结束时间</label>
+ <label class="block text-xs font-bold text-gray-600 mb-1" data-i18n="tlModal.endTime">结束时间</label>
<input type="time" id="tl-new-period-end" value="11:00" class="w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm">
</div>
</div>
<div class="bg-blue-50 border border-blue-100 rounded p-3 text-xs text-blue-700">
- <i class="fa-solid fa-info-circle mr-1"></i>如果开始时间 > 结束时间(如 22:00~01:00),将自动识别为跨午夜时间段。
+ <i class="fa-solid fa-info-circle mr-1"></i><span data-i18n="tlModal.crossMidnight">如果开始时间 > 结束时间(如 22:00~01:00),将自动识别为跨午夜时间段。</span>
</div>
</div>
<div class="flex justify-end gap-2 mt-6">
- <button onclick="closeTlNewPeriodModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg">取消</button>
- <button onclick="confirmTlNewPeriod()" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700">添加</button>
+ <button onclick="closeTlNewPeriodModal()" class="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg" data-i18n="common.cancel">取消</button>
+ <button onclick="confirmTlNewPeriod()" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700" data-i18n="common.add">添加</button>
</div>
</div>
</div>
+ <script src="./assets/i18n.js"></script>
<script src="./assets/script.js"></script>
</body>
</html>