Greasy Fork

来自缓存

Greasy Fork is available in English.

Google AI Studio 汉化脚本

将 Google AI Studio (aistudio.google.com) 页面的主要 UI 元素翻译为中文,已更新2026.4.22

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Google AI Studio 汉化脚本
// @namespace    http://tampermonkey.net/
// @version      2.2.0
// @description  将 Google AI Studio (aistudio.google.com) 页面的主要 UI 元素翻译为中文,已更新2026.4.22
// @match        https://aistudio.google.com/*
// @grant        none
// @author       Betsy
// @license MIT
// @run-at       document-start
// ==/UserScript==
(() => {
  'use strict';

  // microtask 兜底
  if (typeof window.queueMicrotask !== 'function') {
    window.queueMicrotask = (cb) => (typeof Promise === 'function'
      ? Promise.resolve().then(cb).catch(e => setTimeout(() => { throw e; }))
      : setTimeout(cb, 0));
  }
  // —— 静态与模糊词典 ——
  const EXACT = new Map([
    // 顶部栏与通用
    ['Block high probability of being harmful', '高概率有害,予以拦截'],
    ['Harassment', '骚扰'],['Hate', '憎恨'],['Sexually Explicit', '色情'],
    ['Block medium or high probability of being harmful', '阻止可能有害的内容'],
    ['Start typing a prompt to see what our models can do', '开始输入提示,看看我们的模型能做什么'],
    ['Block low, medium and high probability of being harmful', '阻止低、中、高风险的有害内容'],['Search for a model', '搜索模型'],
    ['Always show regardless of probability of being harmful', '无论有害的可能性如何,始终表现出来'],['Share', '分享'],['Rename', '重命名'],
    ['Get API key', '获取 API 密钥'], ['Help', '帮助'], ['Settings', '设置'], ['Create new', '新建'],['Build your ideas with Gemini', '与Gemini一起构建您的想法'],
    ['Switch to a paid API key to unlock higher quota and more features.', '切换到付费API密钥以解锁更高配额和更多功能。'],['Stream, Imagen and Veo have moved to the model picker in chat!', 'Stream、Imagen和Veo都有移动到这里的实验区聊天!'],
    ['Model', '模型'], ['Run', '运行'], ['Run settings', '运行设置'], ['Untitled prompt', '无标题提示'],['Set the thinking level', '设置思考等级'],['Let it snow', '下雪特效'],
    ['This model is not stable and may not be suitable for production use.', '该模型不稳定,可能不适合生产环境使用。'],['Thinking level', '思考等级'],['High', '高'],['Remove Grounding with Google Search', '移除 Google 搜索基座'],
    ['Off', '关闭'],['Block none', '无屏蔽'],['Block few', '屏蔽少数'],['Block some', '屏蔽一些'],['Block most', '屏蔽大部分'],['View status', '查看状态'],['Submit prompt key', '发送消息'],[' Remove URL context', '移除网址上下文'],
    ['Enter a prompt here', '在此处输入提示'], ['Add an example', '添加示例'], ['Input', '输入'], ['Output', '输出'],['Do not run safety filters', '不运行安全过滤器'],['Home', '主页'],['Copied to clipboard', '已复制到剪贴板'],
    ['Get code', '获取代码'], ['Save', '保存'], ['Chat', '聊天'], ['Stream', '流式'], ['Generate media', '生成媒体'],['Run prompt', '输入提示'],['Reset defaults', '恢复默认设置'],['Insert images, videos, audio, or files', '插入图像、视频、音频,或文件'],
    ['Build', '构建'], ['History', '历史记录'], ['Dashboard', '仪表盘'], ['Documentation', '文档'],['Generate structured output', '生成结构化输出'],['Dangerous Content', '危险内容'],['Type', '类型'],['Developer docs', '开发者文档'],['Speech to text', '语音转文本'],
    ['Total API Requests per Day', '每天的 API 请求总数'],['Total API Errors per Day', '每天的 API 错误总数'],['Studio', '实验室'],['My history', '我的对话历史'],['Open in Drive', '在云端硬盘打开'],['Description', '描述'],[' Remove Structured outputs', '移除结构化输出'],
    ['Temperature', '温度'], ['Top-K', 'Top‑K'], ['Top-P', 'Top‑P'], ['Advanced settings', '高级设置'],['Lets Gemini use code to solve complex tasks', '让 Gemini 使用代码来解决复杂的任务'],['No Data Available', '没有可用数据'],[' Remove Function calling', '移除函数调用'],
    ['Safety settings', '安全设置'], ['Edit', '编辑'], ['Stop sequences', '停止序列'], ['Add stop sequence', '添加停止序列'],['Probability threshold for top-p sampling', 'top-p 采样概率阈值'],['Cancel generation', '取消生成'],['Updated','更新'],
    ['Output length', '输出长度'], ['Tools', '工具'], ['URL context', 'URL 上下文'], ['Structured output', '结构化输出'],['Maximum number of tokens in response', '响应中的最大令牌数'],['Ready to chat!', '准备好聊天了!'],['Ready to chat','准备好聊天了!'],
    ['Code execution', '代码执行'], ['Function calling', '函数调用'], ['Grounding with Google Search', '启用 Google 搜索基座'],['Usage & Billing', '使用情况和计费'],['Low', '低'],['Medium', '中'],['Saved to Drive', '保存至云端硬盘'],['Link a paid API key here.', '在此处链接付费API密钥。'],
    ['Source:', '来源:'], ['Source: Google Search', '来源:Google 搜索'],['Creativity allowed in the responses', '回复内容允许创意发挥'],['Changelog', '更新日志'],['API keys', 'API密钥'],['Start typing a prompt', '开始输入提示词'],['Get started with Gemini', '开始使用 Gemini'],
    ['Generate content', '生成内容'], ['Media resolution', '媒体分辨率'], ['Default', '默认'], ['Thinking', '思考'], ['Thinking mode', '思考模式'],['Truncate response including and after string', '截断包含字符串及其之后的内容的响应'],['Good response', '回复得好'],['Bad response', '回复不好'],
    ['Set thinking budget', '设置思考预算'], ['Close?', '关闭?'], ['Cancel', '取消'], ['Continue', '继续'],['Browse the url context', '浏览网址上下文'],['Lets you define functions that Gemini can call', '此工具与当前活动工具不兼容。'],['User','用户'],
    ['Model selection', '模型选择'], ['All', '全部'], ['Featured', '精选'], ['Images', '图像'], ['New', '新'],['Adjust harmful response settings', '调整有害内容设置'],['Run safety settings', '运行安全设置'],['Rerun', '重试'],['Delete', '删除'],['Google Search Suggestions', 'Google搜索建议'],
    ['Temporary chat', '临时聊天'], ['Reset default settings', '恢复默认设置'],['Higher resolutions may provide better understanding but use more tokens.', '更高的分辨率可能提供更好的理解,但会消耗更多 token。'],['Share prompt', '分享对话'],['Name', '名称'],
    ['You need to create and run a prompt in order to share it', '您需要创建并运行一个提示才能分享它。'],['More options', '更多选项'],['New chat', '开启新对话'],['Project', '项目'],['Generate structured outputs', '生成结构化输出'],['Structured outputs', '结构化输出'],
    ['System instructions', '系统指令'], ['Chat prompt', '聊天提示'], ['Compare mode', '对比模式'],['Let the model decide how many thinking tokens to use or choose your own value', '让模型决定使用多少思考令牌,或自行选择值'],['Make a copy', '备份'],['Time Range', '时间范围'],
    ['Already in a new chat', '已处于新聊天'], ['Save the prompt before sharing it', '分享前请先保存提示'],['Use Google Search', '使用谷歌搜索'],['Expand prompts history', '展开对话历史'],['Create generative media', '创作生成式媒体'],['No changes to save', '没有更改需要保存'],
    ['View more actions', '更多操作'], ['Show conversation without markdown formatting', '以纯文本展示对话(不含 Markdown 格式)'],['Edit title and description', '编辑标题和描述'],['Collapse prompts history', '折叠对话历史'],['experimental', '实验性的'],['Thoughts', '思考'],
    ['Get SDK code to chat with Gemini', '获取与 Gemini 聊天的 SDK 代码'],['Unable to disable thinking mode for this model.', '无法为此模型禁用思考模式。'],['Enable or disable thinking for responses', '启用或禁用响应思考'],['Download', '下载'],['Copy to clipboard', '复制到剪贴板'],
    ['Adjust how likely you are to see responses that could be harmful. Content is blocked based on the probability that it is harmful.', '调整您看到可能有害的回复的可能性。根据内容有害的可能性被屏蔽。'],['Stop', '停止'],['Auto', '自动'],['Expand to view model thoughts', '展开以查看模型想法'],
    ['You are responsible for ensuring that safety settings for your intended use case comply with the Terms and Use Policy. Learn more.', '您有责任确保预期用例的安全设置符合条款和使用政策。了解详情。'],['Or try some examples', '或者尝试一些例子'],['Overview', '概述'],['Start', '开始'],
    ['Try Nano Banana', '尝试 Nano Banana'],['Theme', '主题'],['System', '系统'],['Dark', '暗黑'],['Light', '明亮'],['Terms of service', '服务条款'],['Privacy policy', '隐私政策'],['Send feedback', '发送反馈'],['Billing Support', '账单支持'],['Collapse code snippet', '折叠代码片段'],
    ['Showcase', '展示'],['Your apps', '你的应用'],['Recent apps', '最近的应用'],['FAQ', '常见问题'],['No apps created yet. Build your first app now.', '尚未创建任何应用。立即构建您的第一个应用程序。'],['Need some inspiration? See examples in', '需要一些灵感吗?请参阅以下示例:'],['Gallery', '画廊'],
    ['Usage information displayed is for the API and does not reflect AI Studio usage, which is offered free of charge.', '显示的使用信息适用于 API,并不反映免费提供的 AI Studio 使用情况。'],['Input Tokens per Day', '每天输入的令牌数'],['Requests per Day', '每天的请求数'],['Audio', '音频'],['Video', '视频'],
    ['Sample Media', '示例媒体'],['Branch from here', '从这里分支'],['Copy as text', '复制为文本'],['Copy as markdown', '复制为 Markdown'],['Rerun this turn', '重新运行本消息'],['View all history', '查看所有历史记录'],['The fastest way from prompt to production with Gemini', '从提示到生产,使用 Gemini 实现最快路径'],
    ['Display of Search Suggestions is required when using Grounding with Google Search. ', '使用 Google 搜索的 Grounding 功能时,必须显示搜索建议'],['Learn more', '了解详情'],['Sources', '来源'],['My Drive', '我的Google云盘'],['Upload File', '上传文件'],['Record Audio', '录制音频'],
    ['Select or upload a file on Google Drive to include in your prompt', '在 Google 云端硬盘中选择或上传文件以包含在您的提示中'],['Upload a file to Google Drive to include in your prompt', '将文件上传到 Google 云端硬盘以包含在您的提示中'],['Camera', '相机'],['YouTobe Video', 'YouTobe 视频'],
    ['Build apps with Gemini', '使用 Gemini 构建应用'],['Start from a template', '从模板开始'],['Dynamic text game using Gemini', '使用 Gemini 的动态文本游戏'],['Gemini powered code review tool', 'Gemini 驱动的代码审查工具'],['Add files', '添加文件'],['Usage', '使用情况'],['Billing', '计费'],
    ['Gemini speech generation', 'Gemini 语音生成'],['Lyria RealTime', 'Lyria 实时'],['Talk to Gemini live', '与 Gemini 即时交流'],['Talk', '讲话'],['Webcam', '使用摄像头'],['Share Screen', '共享屏幕'],['Insert assets such as images, videos, folders, files, or audio', '插入图片、视频、文件夹、文件或音频等资源'],
    ['Start typing a prompt, use alt + enter to append', '开始输入提示,使用 alt + enter 追加'],['API pricing per 1M tokens.', 'API 按每百万令牌计费。'],['Usage in AI Studio UI is free of charge when no API key is selected', '未选择 API 密钥时,在 AI Studio UI 中使用是免费的'],['All context lengths', '所有上下文长度'],
    ['Text', '文本'],['Switch model?', '切换模型?'],['Switching to this model will start a new chat.', '切换这个模型将会在新聊天中对话'],['Do you want to continue?', '您要继续吗?'],['Switching to this model will remove the images from your prompt', '切换到此模型将从提示中删除图像'],

    // Gemini 3 系列 / Nano Banana
    ['Gemini 3 Pro Preview', 'Gemini 3 Pro 预览版'],
    ['Gemini 3 Flash Preview', 'Gemini 3 Flash 预览版'],
    ['gemini-3-pro-preview', 'gemini-3-pro-preview'],
    ['Nano Banana', 'Nano Banana'],
    ['gemini-2.5-flash-image', 'gemini-2.5-flash-image'],
    ['Gemini 2.5 Pro', 'Gemini 2.5 Pro'],
    ['Gemini Flash Latest', 'Gemini Flash 最新版'],
    ['State-of-the-art image generation and editing model.', '最先进的图像生成和编辑模型。'],
    ['(aka Gemini 2.5 Flash Image) State-of-the-art image generation and editing model.', '(又名 Gemini 2.5 Flash Image)最先进的图像生成和编辑模型。'],
    ['gemini-2.5-flash-image-preview', 'Gemini-2.5-flash-image-preview'],
    // Gemini 3.1 系列及描述
    ['Gemini 3.1 Flash Image Preview', 'Gemini 3.1 Flash 图像预览版'],
    ['Gemini 3.1 Flash Lite Preview', 'Gemini 3.1 Flash Lite 预览版'],
    ['gemini-3.1-flash-image-preview', 'gemini-3.1-flash-image-preview'],
    ['gemini-3.1-flash-lite-preview', 'gemini-3.1-flash-lite-preview'],
    ['Pro-level visual intelligence with Flash-speed efficiency and reality-grounded generation capabilities.', '专业级视觉智能,具备 Flash 级的效率和基于现实的生成能力。'],
    ['Our most cost-efficient model, optimized for high-volume agentic tasks, translation, and simple data processing.', '我们最具成本效益的模型,针对大规模智能体任务、翻译和简单的数据处理进行了优化。'],
    ['Paid', '付费'],
    ['Nano Banana 2', 'Nano Banana 2'],

    // Gemma 4 系列
    ['Gemma 4 26B A4B IT', 'Gemma 4 26B A4B IT'],['gemma-4-26b-a4b-it', 'gemma-4-26b-a4b-it'],
    ['A Mixture-of-Experts model that activates only 4B parameters per inference, delivering high-performance reasoning with a fraction of the memory cost — ideal for cost-efficient, high-throughput server deployments.', '混合专家 (MoE) 模型,每次推理仅激活 4B 参数,以极低的内存成本提供高性能推理——非常适合经济高效、高吞吐量的服务器部署。'],
    ['Gemma 4 31B IT', 'Gemma 4 31B IT'],['gemma-4-31b-it', 'gemma-4-31b-it'],['Google DeepMind\'s flagship open-weight dense model, purpose-built for maximum quality in data center environments with a 256K context window and advanced long-context architecture.', 'Google DeepMind 的旗舰级开源权重稠密模型,专为在数据中心环境中实现最高质量而构建,拥有 256K 上下文窗口和先进的长上下文架构。'],

    // Lyria 3 系列
    ['Lyria 3 Pro Preview', 'Lyria 3 Pro 预览版'],
    ['lyria-3-pro-preview', 'lyria-3-pro-preview'],['Our advanced, full-song generative model with deep compositional understanding, optimized for precise structural control and complex transitions across diverse musical styles.', '我们先进的全曲生成模型,具有深刻的作曲理解力,专为精确的结构控制和跨越不同音乐风格的复杂过渡而优化。'],['Lyria 3 Clip Preview', 'Lyria 3 Clip 预览版'],
    ['lyria-3-clip-preview', 'lyria-3-clip-preview'],['Our low-latency, music generation model optimized for high-fidelity audio clips and precise rhythmic control.', '我们的低延迟音乐生成模型,专为高保真音频片段和精确的节奏控制而优化。'],

    // Veo 3.1 Lite 系列
    ['Veo 3.1 lite', 'Veo 3.1 Lite 版'],['veo-3.1-lite-generate-preview', 'veo-3.1-lite-generate-preview'],['Our most cost-efficient video generation model, designed for rapid iteration and building high-volume applications.', '我们最具成本效益的视频生成模型,专为快速迭代和构建高容量应用而设计。'],

    // Gemini 3.1 Live 系列
    ['Gemini 3.1 Flash Live Preview', 'Gemini 3.1 Flash Live 预览版'],['gemini-3.1-flash-live-preview', 'gemini-3.1-flash-live-preview'],['Our low-latency, audio-to-audio model optimized for real-time dialogue with acoustic nuance detection, numeric precision, and multimodal awareness.', '我们的低延迟端到端音频模型,专为实时对话优化,具备声音细节检测、数字精度和多模态感知能力。'],

    // 快捷指令、菜单与开关
    ['Autocomplete', '自动补全'],
    ['Applet notifications', '小程序通知'],
    ['Enabled', '已启用'],
    ['Disabled', '已禁用'],
    ['Vibe code an app', '使用 Vibe 编写应用'],
    ['Grounding with Google Maps', '启用 Google 地图基座'],
    ['Append to prompt (Alt + Enter)', '追加到提示 (Alt + Enter)'],
    ['View keyboard shortcuts', '查看键盘快捷键'],['Search', '搜索'],
    ['Start a chat with a model', '开始与模型对话'],['Search within this chat session', '在当前对话中搜索'],

    ['Build with Agents', '使用智能体构建'],
    ['Our agent for long-running context gathering & synthesis tasks, optimized for speed and efficiency.', '我们的智能体用于长期运行的上下文收集与综合任务,针对速度和效率进行了优化。'],
    ['Our SOTA agent for long-running context gathering & synthesis tasks, optimized for maximum search exhaustiveness and report comprehensiveness.', '我们最先进的智能体,用于长期运行的上下文收集与综合任务,针对最大化搜索详尽度和报告全面性进行了优化。'],

    ['Upgrade to unlock more', '升级以解锁更多功能'],
    ['Access higher limits, Pro models, and more.', '获取更高的配额、Pro 模型及更多专属功能。'],

    ['Explore Google models', '探索 Google 模型'],
    ['Test out our most advanced and newest models.', '测试我们最先进和最新的模型。'],
    ['Code and Chat', '代码与聊天'],
    ['Build chatbots, agents, and code with Gemini 3.', '使用 Gemini 3 构建聊天机器人、智能体和代码。'],
    ['Speech and Music', '语音与音乐'],
    ['Explore our text to speech and music generation models.', '探索我们的文本转语音和音乐生成模型。'],
    ['Real-time voice and video with Live API.', '使用 Live API 实现实时语音和视频互动。'],

    // Playground & Imagen 4
    ['Playground', '实验区'],
    ['Our latest image generation model, with significantly better text rendering and better overall image quality.', '我们最新的图像生成模型,具有显著提升的文本渲染效果和更佳的整体图像质量。'],
    ['Unknown', '未知'],
    ['This model uses Gemini 3.1 Pro and Gemini 3 Flash pricing.', '此模型采用 Gemini 3.1 Pro 和 Gemini 3 Flash 的计费标准。'],
    ['Developers may see both items on their bill.', '开发者可能会在账单上看到这两个计费项。'],
    ['Gemini 3.1 Flash TTS Preview', 'Gemini 3.1 Flash TTS 预览版'],
    ['gemini-3.1-flash-tts-preview', 'gemini-3.1-flash-tts-preview'],
    ['Gemini 3.1 Flash TTS: Powerful, low-latency speech generation. Enjoy natural outputs, steerable prompts, and new expressive audio tags for precise narration control.', 'Gemini 3.1 Flash TTS:强大的低延迟语音生成。享受自然的输出、可引导的提示词,以及用于精确控制旁白的新型表现力音频标签。'],

    // Gemini 2.0 / TTS / Veo / Robotics
    ['Gemini 2.0 Flash', 'Gemini 2.0 Flash'],
    ['Our most balanced multimodal model with great performance across all tasks.', '我们最均衡的多模态模型,在所有任务中都表现出色。'],
    ['Gemini 2.0 Flash-Lite', 'Gemini 2.0 Flash-Lite'],
    ['Gemini 2.5 Flash Native Audio Preview 09-2025', 'Gemini 2.5 Flash 原生音频预览版 09-2025'],
    ['Our native audio models optimized for higher quality audio outputs with better pacing, voice naturalness, verbosity, and mood.', '我们的原生音频模型经过优化,可提供更高质量的音频输出,具有更好的节奏、声音自然度、详细程度和情绪。'],
    ['Gemini 2.5 Pro Preview TTS', 'Gemini 2.5 Pro 预览版 TTS'],
    ['Our 2.5 Pro text-to-speech audio model optimized for powerful, low-latency speech generation for more natural outputs and easier to steer prompts.', '我们的 2.5 Pro 文本转语音音频模型为强大、低延迟的语音生成进行了优化,以实现更自然的输出和更容易引导的提示。'],
    ['Gemini 2.5 Flash Preview TTS', 'Gemini 2.5 Flash 预览版 TTS'],
    ['Our 2.5 Flash text-to-speech audio model optimized for price-performant, low-latency, controllable speech generation.', '我们的 2.5 Flash 文本转语音音频模型为高性价比、低延迟、可控的语音生成进行了优化。'],
    ['Veo 2', 'Veo 2'],
    ['Our state-of-the-art video generation model, available to developers on the paid tier of the Gemini API.', '我们最先进的视频生成模型,可通过 Gemini API 的付费层级提供给开发者使用。'],
    ['Gemini Robotics-ER 1.5 Preview', 'Gemini Robotics-ER 1.5 预览版'],
    ['Gemini Robotics-ER, short for Gemini Robotics-Embodied Reasoning, is a thinking model that enhances robots\' abilities to understand and interact with the physical world.', 'Gemini Robotics-ER,即 Gemini 机器人具身推理的缩写,是一种思维模型,可增强机器人理解物理世界并与之互动的能力。'],

    // Gemini 2.0 系列描述更新
    ['Our second generation multimodal model with great performance across all tasks.', '我们的第二代多模态模型,在所有任务中都有出色表现。'],
    ['Our second generation small and cost effective model, built for at scale usage.', '我们的第二代小型高效模型,专为大规模使用而设计。'],

    // Gemini 2.5 / Flash 最新版描述更新
    ['Our previous generation advanced reasoning model, which excels at coding and complex reasoning tasks', '我们上一代的高级推理模型,擅长编程和复杂推理任务'],
    ['An alias to our latest Flash model which changes over time.', '指向我们最新 Flash 模型的别名,会随时间更新。'],
    ['An alias to our latest Flash-Lite model which changes over time.', '指向我们最新 Flash-Lite 模型的别名,会随时间更新。'],
    ['Our state-of-the-art image generation and editing model.', '最先进的图像生成和编辑模型。'],

    // Veo 2 描述更新
    ['Our second generation video generation model, available to developers on the paid tier of the Gemini API.', '我们的第二代视频生成模型,可通过 Gemini API 的付费层级提供给开发者。'],

    // --- 新增条目 ---
    ['Veo 3.1', 'Veo 3.1'],
    ['Veo 3.1 fast', 'Veo 3.1 高速版'],
    ['Our latest video generation model, available to developers on the paid tier of the Gemini API.', '我们最新的视频生成模型,可通过 Gemini API 的付费层级提供给开发者使用。'],
    ['A faster, more accessible version of Veo 3.1, optimized for speed and business use cases. Available to developers on the paid tier of the Gemini API.', 'Veo 3.1 的更快、更易用的版本,针对速度和业务用例进行了优化。可通过 Gemini API 的付费层级提供给开发者使用。'],
    ['Gemini 2.5 Flash Native Audio Preview 12-2025', 'Gemini 2.5 Flash 原生音频预览版 12-2025'],
    ['Our native audio model optimized for higher quality audio outputs with better pacing, voice naturalness, verbosity, and mood.', '我们的原生音频模型,经过优化可提供更高质量的音频输出,具有更好的节奏、语音自然度、详细程度和情绪。'],
    ['Send prompt (Ctrl + Enter)', '发送提示 (Ctrl + Enter)'],
    ['Choose a paid API key', '选择付费 API 密钥'],
    ['Our latest SOTA reasoning model with unprecedented depth and nuance, and powerful multimodal understanding and coding capabilities', '我们最新的 SOTA 推理模型,具有前所未有的深度和细腻度,以及强大的多模态理解和编码能力'],
    ['Our first Gemini 3 reasoning model with advanced intelligence and multimodal understanding, and powerful agentic and vibe coding capabilities', '我们的首款 Gemini 3 推理模型,具有先进的智能和多模态理解能力,以及强大的智能体和 Vibe 编程能力'],
    ['You have no Paid Project. Please view the Projects Page to choose a Project and Upgrade.', '您没有付费项目。请访问项目页面以选择项目并进行升级。'],
    ['Go to Projects Page', '前往项目页面'],
    ['+ New app', '+ 新建应用'],
    ['Build AI apps', '构建 AI 应用'],
    ['Chat with models', '与模型对话'],
    ['Monitor API usage', '监控 API 使用情况'],
    ['Start building with Gemini', '开始使用 Gemini 进行构建'],
    ['Our top picks including Gemini 3 Pro and Nano Banana Pro.', '我们的精选推荐,包括 Gemini 3 Pro 和 Nano Banana Pro。'],
    ['Chat and Reasoning', '聊天与推理'],
    ['Build chatbots, agents, and code with Gemini 3 Pro and Gemini 3 Flash.', '使用 Gemini 3 Pro 和 Gemini 3 Flash 构建聊天机器人、智能体和代码。'],
    ['Image Generation', '图像生成'],
    ['Create and edit images with Nano Banana and Imagen.', '使用 Nano Banana 和 Imagen 创建和编辑图像。'],
    ['Video Generation', '视频生成'],
    ['Generate videos with Veo models, our state of the art video generation models.', '使用 Veo 模型(我们最先进的视频生成模型)生成视频。'],
    ['Text to Speech', '文字转语音'],
    ['Convert text to speech with likelike realism using Gemini TTS.', '使用 Gemini TTS 将文本转换为具有逼真效果的语音。'],
    ['Real-time', '实时'],
    ['Real-time voice and video with Gemini Live.', '通过 Gemini Live 实现实时语音和视频。'],
    ['Explore and co-develop apps', '探索并共同开发应用'],
    ['See Gemini in action with interactive, open source examples', '通过交互式开源示例查看 Gemini 的实际运作'],
    ['Start building', '开始构建'],
    ['Generate current, verifiable responses from Gemini using Google Search', '使用 Google 搜索让 Gemini 生成实时的、可验证的回复'],
    ['Try in Playground', '在实验室中尝试'],
    ['Quickstart with Gemini API', 'Gemini API 快速入门'],
    ['Explore guides and examples in the Gemini API Cookbook on GitHub', '在 GitHub 上的 Gemini API Cookbook 中探索指南和示例'],
    ['Start a chat or vibe code an app', '开始对话或使用 vibe coding 编写应用'],
    ['Jump back in', '回到上次的操作'],
    ['Try Gemini 3 Flash', '尝试 Gemini 3 Flash'],
    ['Our most intelligent model to date.', '我们迄今为止最智能的模型。'],
    ['Explore Nano Banana Pro', '探索 Nano Banana Pro'],
    ['State-of-the-art image generation and editing', '最先进的图像生成与编辑'],
    ['Create with Veo 3.1', '使用 Veo 3.1 进行创作'],
    ['Our best video generation model, now with sound effects.', '我们最好的视频生成模型,现已支持音效。'],
    ['Turn text into audio with Gemini', '使用 Gemini 将文字转为音频'],
    ['Generate high quality text to speech with Gemini TTS models', '使用 Gemini TTS 模型生成高质量的文字转语音'],['PRODUCTS AND APPS', '产品与应用'],
    ['Gemini App', 'Gemini 应用'],['Chat with Gemini', '与 Gemini 聊天'],['Google Antigravity', 'Google Antigravity'],['Our agentic development platform', '我们的智能体开发平台'],['Code, Reasoning, and Chat', '代码、推理与聊天'],['Raw Mode', '原始模式'],
    ['Gemini API Logs and Datasets', 'Gemini API 日志与数据集'],['Dataset', '数据集'],['All datasets', '所有数据集'],['All models', '所有模型'],['Status', '状态'],['Rating', '评分'],
    ['API pricing per 1M tokens.', '每 100 万令牌的 API 价格。'],
    ['Usage data may take up to 15 minutes to update. Usage information displayed is for the API and does not reflect AI Studio usage, which is offered free of charge (when no API key is selected). For latency/traffic data & method filtering please visit the Google Cloud Console', '使用数据最多可能需要 15 分钟才能更新。显示的使用信息适用于 API,并不反映免费提供的 AI Studio 使用情况(未选择 API 密钥时)。如需查看延迟/流量数据和方法过滤,请访问 Google Cloud 控制台'],
    ['Usage in AI Studio UI is free of charge when no API key is selected', '未选择 API 密钥时,在 AI Studio UI 中使用是免费的'],
  ]);

  const PARTIAL = [
    { pattern: /^\s*Google\s+AI\s+models\s*$/i, replace: 'Google AI 模型' },
    { pattern: /^\s*may\s+make\s+mistakes[\s\S]*?double-check\s+outputs\.?\s*$/i, replace: '可能出错,请务必复核输出。' },
    { pattern: /^Design a custom birthday card.*$/i, replace: '设计一张定制生日贺卡' },
    { pattern: /^Try\s+(.+)$/i, replace: '试试 $1' },
    { pattern: /^Closing the chat will lose the data\. Do you want to continue\?$/i, replace: '关闭此聊天将丢失数据,是否继续?' },
    { pattern: /\bText\b\s*[::]\s*/i, replace: '文本:' },
    { pattern: /\bImage\b\s*\(\*?Output per image\)\s*[::]\s*/i, replace: '图像(每张输出):' },
    { pattern: /\bKnowledge cut ?off\b\s*[::]\s*/i, replace: '知识截止:' },
    { pattern: /\bInput\b\s*[::]\s*/i, replace: '输入:' },
    { pattern: /\bOutput\b\s*[::]\s*/i, replace: '输出:' },
    { pattern: /\bWhat'?s new\b/i, replace: '最新动态' },
    { pattern: /\bTry an example app\b/i, replace: '试用示例应用' },
    { pattern: /^Add stop\b.*$/i, replace: '添加停止序列…' },
    { pattern: /\bOutput tokens?\b.*$/i, replace: '输出长度' },
    { pattern: /\bTop\s*P\b/i, replace: 'Top‑P' },
    { pattern: /\bTop\s*K\b/i, replace: 'Top‑K' },
    { pattern: /^Selected[:\s]+(.+?)$/i, replace: '已选择 $1' },
    { pattern: /\bURL context tool\b/i, replace: 'URL 上下文工具' },
    { pattern: /\bNative speech generation\b/i, replace: '原生语音生成' },
    { pattern: /\bLive audio-to-audio dialog\b/i, replace: '实时语音对话' },
    { pattern: /Google AI models may make mistakes.*double-check outputs\.?/i, replace: 'Google AI 模型可能出错,请务必复核输出。' },
    { pattern: /This model has limited free quota for testing\.?/i, replace: '此模型的免费配额仅用于测试' },
    { pattern: /Stop\s+generation\s+before\s+creating\s+a\s+new\s+chat/i, replace: '创建新对话前请停止生成' },
    { pattern: /To generate images beyond the limit or use the model in your projects, use the Gemini API\.?/i, replace: '若需超限生成或在项目中使用,请使用 Gemini API' },
    { pattern: /^Speaker\s+(?<num>\d+)(?<suffix>\s+settings)?$/i, replace: ({ groups }) => `演讲者 ${groups.num}${groups.suffix ? ' 设置' : ''}`},
    { pattern: /API pricing per 1M tokens/i, replace: 'API 按每百万令牌计费' },
    { pattern: /Usage in AI Studio UI is free of charge when no API key is selected/i, replace: '未选择 API 密钥时,在 AI Studio UI 中使用是免费的' },
    { pattern: /Start typing a prompt, use alt \+ enter to append/i, replace: '开始输入提示,使用 alt + enter 追加' },
    // 处理指向文本
    { pattern: /^Points to\s+(.+)$/i, replace: '指向 $1' },
    { pattern: /Welcome back,\s+(.+)/i, replace: '欢迎回来,$1' },
    { pattern: /(\d+)\s+week\s+ago/i, replace: '$1 周前' },
    { pattern: /(\d+)\s+day\s+ago/i, replace: '$1 天前' },
    { pattern: /(\d+)\s+hour\s+ago/i, replace: '$1 小时前' },
    { pattern: /(\d+)\s+days\s+\(max\)/i, replace: '$1 天(最大)' },
    { pattern: /\bAudio\/Video\b/i, replace: '音频/视频' },
    // 处理 Token 数量显示
    { pattern: /<=(\d+K)\s+tokens/i, replace: '<=$1 令牌' },
    { pattern: />\s*(\d+K)\s+tokens/i, replace: '> $1 令牌' },
    // 模糊匹配描述
    { pattern: /Send prompt \(Ctrl \+ Enter\)\s*Append to prompt \(Alt \+ Enter\)/i, replace: '发送提示 (Ctrl + Enter)\n追加到提示 (Alt + Enter)' },
    { pattern: /Our second generation multimodal model/i, replace: '我们的第二代多模态模型' },
    { pattern: /Our second generation small and cost effective model/i, replace: '我们的第二代小型高效模型' },
    { pattern: /Our second generation video generation model/i, replace: '我们的第二代视频生成模型' },
    { pattern: /An alias to our latest.*model/i, replace: '指向我们最新模型的别名,会随时间更新。' },
    { pattern: /Usage data may take up to 15 minutes to update/i, replace: '使用数据最多可能需要 15 分钟才能更新。' },
    { pattern: /Usage information displayed is for the API and does not reflect AI Studio usage/i, replace: '显示的使用信息适用于 API,并不反映 AI Studio 的使用情况' },
    { pattern: /which is offered free of charge \(when no API key is selected\)/i, replace: '(未选择 API 密钥时免费提供)' },
    { pattern: /For latency\/traffic data & method filtering please visit the/i, replace: '如需查看延迟/流量数据和方法过滤,请访问' },
    { pattern: /Google Cloud Console/i, replace: 'Google Cloud 控制台' },
    { pattern: /\bText, image and video\b/i, replace: '文本、图像和视频' },
    { pattern: /\bText\b\s*[•::]\s*/i, replace: '文本 • ' },
    { pattern: /\bAudio\b\s*[•::]\s*/i, replace: '音频 • ' },
    { pattern: /\bImage\b\s*\(\*?Output per image\)\s*[•::]\s*/i, replace: '图像(每张输出) • ' },
    { pattern: /^Deep Research Preview\s*\((.+)\)$/i, replace: '深度研究预览版 ($1)' },
    { pattern: /^Deep Research Max Preview\s*\((.+)\)$/i, replace: '深度研究 Max 预览版 ($1)' },
    // 计费项与发布日期前缀
    { pattern: /\bRelease date\s*[::]\s*/i, replace: '发布日期:' },
    { pattern: /\bSong generation\b\s*\(\*?Output per song\)\s*[•::]\s*/i, replace: '歌曲生成(每首输出) • ' },
    { pattern: /\bVideo\b\s*\(\*?Output per video 720p\)\s*[•::]\s*/i, replace: '视频(每 720p 输出) • ' },
    { pattern: /\bVideo\b\s*\(\*?Output per video 1080p\)\s*[•::]\s*/i, replace: '视频(每 1080p 输出) • ' },
    { pattern: /\bImage\/video\b\s*[•::]\s*/i, replace: '图像/视频 • ' },
  ];

  // —— 动态数字解析 ——
  function compactToNumber(str) {
    const m = String(str).replace(/[, ]/g, '').match(/^([\d.]+)\s*([kKmMbBtT])?$/);
    if (!m) return Number(str) || NaN;
    const n = parseFloat(m[1]);
    const s = (m[2] || '').toUpperCase();
    const factor = s === 'K' ? 1e3 : s === 'M' ? 1e6 : s === 'B' ? 1e9 : s === 'T' ? 1e12 : 1;
    return n * factor;
  }
  function formatCnShort(n) {
    if (!isFinite(n)) return '';
    if (n >= 1e12) return (n / 1e12).toFixed(n % 1e12 ? 1 : 0).replace(/\.0$/, '') + '万亿';
    if (n >= 1e8) return (n / 1e8 ).toFixed(n % 1e8 ? 1 : 0).replace(/\.0$/, '') + '亿';
    if (n >= 1e4) return (n / 1e4 ).toFixed(n % 1e4 ? 1 : 0).replace(/\.0$/, '') + '万';
    return String(Math.round(n));
  }

  // —— 动态句式(命名捕获 + 回调) ——
  const DYNAMIC = [
    // 模型卡:Gemini 3 Pro 复杂描述
    {
      pattern: /Our\s+most\s+intelligent\s+model\s+with\s+SOTA\s+reasoning\s+and\s+multimodal\s+understanding,?\s+and\s+powerful\s+agentic\s+and\s+vibe\s+coding\s+capabilities\.?/i,
      replace: '我们最智能的模型,具备 SOTA 推理和多模态理解能力,以及强大的智能体和 Vibe 编程能力。'
    },
    // Gemini 3 Flash
    {
      pattern: /Our\s+most\s+intelligent\s+model\s+built\s+for\s+speed,\s+combining\s+frontier\s+intelligence\s+with\s+superior\s+search\s+and\s+grounding\.?/i,
      replace: '我们最智能的模型专精速度,结合前沿情报具有卓越的搜索和嵌入能力。'
    },
    // 模型卡:混合推理 + 上下文 + 思考预算
    {
      pattern: /Our\s+hybrid\s+reasoning\s+model,\s+with\s+(?:up\s+to\s+)?(?:an?\s+)?(?<num>[\d.,]+(?:\s*[kKmMbBtT])?)\s+token\s+context\s+window(?:\s+and\s+thinking\s+budgets)?\.?/i,
      replace: ({ groups }) => {
        const n = compactToNumber(groups?.num || '');
        const cn = isFinite(n) ? `${formatCnShort(n)} token` : `${groups?.num || ''} token`;
        return `混合推理模型,拥有 ${cn} 上下文窗口,并支持思考预算。`;
      }
    },
    // 模型卡:最强推理 (旧版)
    {
      pattern: /Our\s+most\s+powerful\s+reasoning\s+model,?\s+which\s+excels\s+at\s+coding\s+and\s+complex\s+reasoning\s+tasks\.?/i,
      replace: () => '最强推理模型,擅长编程与复杂推理任务。'
    },
    // 模型卡:高级推理 (Gemini 2.5 Pro)
    {
      pattern: /Our\s+advanced\s+reasoning\s+model,?\s+which\s+excels\s+at\s+coding\s+and\s+complex\s+reasoning\s+tasks\.?/i,
      replace: () => '我们的高级推理模型,擅长编程和复杂推理任务。'
    },
    // 模型卡:最小高性价比
    {
      pattern: /Our\s+smallest\s+and\s+most\s+cost\s+effective\s+model,?\s+built\s+for\s+at\s+scale\s+usage\.?/i,
      replace: () => '体量最小且高性价比的模型,适用于大规模使用。'
    },
    // “知识截止:”前缀
    {
      pattern: /\bKnowledge cut ?off\b\s*:\s*(?<rest>.+)$/i,
      replace: ({ groups }) => `知识截止:${groups?.rest || ''}`
    },

    // —— 输入框动态示例(通用指令句) ——
    {
      pattern: /^Plot\s+(?<expr>.+?)\s+from\s+(?<a>.+?)\s+to\s+(?<b>.+?)\.\s*Generate\s+the\s+resulting\s+graph\s+image\.?$/i,
      replace: ({ groups }) => `绘制 ${groups?.expr || ''} 在区间 ${groups?.a || ''} 到 ${groups?.b || ''} 的曲线。生成对应的图像。`
    },
    {
      pattern: /^Explain\s+the\s+probability\s+of\s+(?<topic>.+?)\.?$/i,
      replace: ({ groups }) => `解释 ${groups?.topic || ''} 的概率。`
    },
    {
      pattern: /^Generate\s+Python\s+code\s+for\s+(?<task>.+?)\.?$/i,
      replace: ({ groups }) => `生成用于 ${groups?.task || ''} 的 Python 代码。`
    },
    {
      pattern: /^(?:Create|Design)\s+(?:a|an)\s+(?<thing>.+?)\.?$/i,
      replace: ({ groups }) => `创建/设计 ${groups?.thing || ''}。`
    },
    {
      pattern: /^Translate\s+(?<src>.+?)\s+to\s+(?<dst>.+?)\.?$/i,
      replace: ({ groups }) => `将 ${groups?.src || ''} 翻译为 ${groups?.dst || ''}。`
    }
  ];

  // —— 属性与排除配置 ——
  const ATTRS = [
    'title','placeholder','alt',
    'aria-label','aria-description','aria-placeholder','aria-valuetext','aria-roledescription',
    'data-tooltip','data-title','aria-modal'
  ];
  const EXCLUDE_TAGS = new Set(['SCRIPT','STYLE','TEXTAREA','CODE','PRE']);
  const MARK = 'data-i18n-zh';
  const DIALOG_SELECTORS = [
    'dialog','[role="dialog"]','[role="alertdialog"]','[aria-modal="true"]',
    '.MuiModal-root','.MuiDialog-root','.MuiPopover-root','.MuiMenu-root','.MuiTooltip-popper',
    '.MuiSnackbar-root', '.MuiAlert-root', '[role="status"]'
  ].join(',');

  // —— 翻译器(精确 → 模糊 → 动态) ——
  function translateText(text) {
    if (!text) return null;
    const original = String(text);
    const trimmed = original.trim();
    if (!trimmed) return null;

    if (EXACT.has(trimmed)) return original.replace(trimmed, EXACT.get(trimmed));
    for (let i = 0; i < PARTIAL.length; i += 1) {
      const { pattern, replace } = PARTIAL[i];
      if (pattern.test(original)) return original.replace(pattern, replace);
    }
    for (let i = 0; i < DYNAMIC.length; i += 1) {
      const { pattern, replace } = DYNAMIC[i];
      if (pattern.test(original)) {
        return original.replace(pattern, (...args) => {
          const last = args[args.length - 1];
          const groups = last && typeof last === 'object' ? last : undefined;
          return typeof replace === 'function' ? replace({ groups }) : replace;
        });
      }
    }
    return null;
  }

  function translateTextNode(node) {
    if (!node || node.nodeType !== Node.TEXT_NODE) return;
    const nv = translateText(node.nodeValue);
    if (nv && nv !== node.nodeValue) {
      node.nodeValue = nv;
      if (node.parentElement) node.parentElement.setAttribute(MARK, '1');
    }
  }

  function translateAttributes(el) {
    if (!el || el.nodeType !== Node.ELEMENT_NODE) return;
    let changed = false;
    for (let i = 0; i < ATTRS.length; i += 1) {
      const attr = ATTRS[i];
      if (el.hasAttribute(attr)) {
        const v = el.getAttribute(attr);
        const nv = translateText(v);
        if (nv && nv !== v) { el.setAttribute(attr, nv); changed = true; }
      }
    }
    if (changed) el.setAttribute(MARK, '1');
  }

  function walk(root) {
    if (!root) return;
    if (root.nodeType === Node.ELEMENT_NODE && EXCLUDE_TAGS.has(root.tagName)) return;
    if (root.nodeType === Node.ELEMENT_NODE) translateAttributes(root);

    let walker;
    try {
      walker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
        acceptNode(n) {
          const v = n && n.nodeValue;
          if (!v || !String(v).trim()) return NodeFilter.FILTER_REJECT;
          const p = n.parentElement;
          if (!p) return NodeFilter.FILTER_ACCEPT;
          if (EXCLUDE_TAGS.has(p.tagName)) return NodeFilter.FILTER_REJECT;
          if (p.isContentEditable) return NodeFilter.FILTER_REJECT;
          return NodeFilter.FILTER_ACCEPT;
        }
      });
    } catch { return; }

    let node;
    while ((node = walker.nextNode())) translateTextNode(node);
    if (root.shadowRoot) walk(root.shadowRoot);
  }

  function observe(target) {
    if (!target) return;
    const obs = new MutationObserver((list) => {
      for (let i = 0; i < list.length; i += 1) {
        const m = list[i];
        if (m.type === 'childList') {
          for (let j = 0; j < m.addedNodes.length; j += 1) {
            const n = m.addedNodes[j];
            if (n.nodeType === Node.ELEMENT_NODE) {
              walk(n);
              if (n.matches && n.matches(DIALOG_SELECTORS)) walk(n);
              if (n.querySelector) n.querySelectorAll(DIALOG_SELECTORS).forEach(d => walk(d));
              if (n.tagName === 'IFRAME') handleIframe(n);
            } else if (n.nodeType === Node.TEXT_NODE) {
              translateTextNode(n);
            }
          }
        } else if (m.type === 'characterData') {
          translateTextNode(m.target);
        } else if (m.type === 'attributes') {
          translateAttributes(m.target);
          if (m.target.matches && m.target.matches(DIALOG_SELECTORS)) walk(m.target);
        }
      }
    });
    obs.observe(target, {
      subtree: true, childList: true, characterData: true,
      attributes: true, attributeFilter: ATTRS
    });
  }

  // 同源 iframe
  function handleIframe(ifr) {
    try {
      const doc = ifr.contentDocument;
      if (doc && doc.documentElement) { walk(doc.documentElement); observe(doc.documentElement); }
    } catch (e) { /* 跨源受限 */ }
  }
  function scanIframes() { document.querySelectorAll('iframe').forEach(handleIframe); }

  // SPA 路由监听
  let lastURL = location.href;
  function scheduleFullScan() {
    queueMicrotask(() => {
      lastURL = location.href;
      walk(document.documentElement);
      scanIframes();
      document.querySelectorAll(DIALOG_SELECTORS).forEach(walk);
    });
  }
  function onUrlMaybeChanged() { if (location.href !== lastURL) scheduleFullScan(); }
  const _ps = history.pushState;
  history.pushState = function (s,t,u){ const r = _ps.apply(this, arguments); onUrlMaybeChanged(); return r; };
  const _rs = history.replaceState;
  history.replaceState = function (s,t,u){ const r = _rs.apply(this, arguments); onUrlMaybeChanged(); return r; };
  window.addEventListener('popstate', onUrlMaybeChanged);
  window.addEventListener('hashchange', onUrlMaybeChanged);

  // Shadow DOM
  const _attachShadow = Element.prototype.attachShadow;
  Element.prototype.attachShadow = function (options) {
    const root = _attachShadow.call(this, options);
    if (options && options.mode === 'open') queueMicrotask(() => { walk(root); observe(root); });
    return root;
  };

  // 对话框聚焦时补扫
  window.addEventListener('focusin', (e) => {
    const el = e.target;
    if (!el || !el.closest) return;
    const dlg = el.closest(DIALOG_SELECTORS);
    if (dlg) walk(dlg);
  });

  // 启动
  function start() {
    walk(document.documentElement);
    observe(document.documentElement);
    scanIframes();
    document.querySelectorAll(DIALOG_SELECTORS).forEach(walk);
  }
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', start, { once: true });
  } else {
    start();
  }
})();