• v0.2.2 ded7a4a2db

    v0.2.2 Stable

    hanyixuanten released this 2026-07-29 20:52:25 +08:00 | 26 commits to master since this release

    Full Changelog: https://github.com/hanyixuanten/btranslate/compare/v0.2.1...v0.2.2

    Btranslate v0.2.2

    This release adds localized administration, failed-translation retries, faster task scheduling, security hardening, and a more reliable packaging workflow.

    本版本新增后台界面本地化和翻译失败重试功能,缩短任务调度延迟,同时加强安全性并改进插件打包流程。

    English

    Added

    • Added per-item retry controls for failed post, page, category, and tag translations.
    • Failed translations now appear below the settings-page progress bar with their target language and a Retranslate action.
    • Added localized administration:
      • English is used by default.
      • Simplified Chinese is loaded when the WordPress locale is zh_CN.
    • Added English and Simplified Chinese GitHub issue forms with structured environment and reproduction fields.
    • Added WordPress.org metadata, GPL-3.0-only licensing, plugin links, bilingual readmes, and Baidu external-service and privacy disclosures.

    Improved

    • Reduced the translation scheduling delay for newly saved content and edited terms from 30 seconds to 10 seconds.
    • Automatic post and page translation is now scheduled only for published content, avoiding translation requests for drafts and other unpublished states.
    • Improved localized sitemap retrieval:
      • Uses the WordPress safe HTTP API.
      • Rejects redirects.
      • Limits responses to 5 MiB.
      • Requires a successful HTTP response.
      • Caches the source sitemap for five minutes.
    • Expanded the English and Chinese documentation with:
      • Baidu Translate API setup instructions.
      • Manual ZIP installation steps.
      • Language routing and permalink guidance.
      • Translation fallback behavior.
      • System requirements and issue-reporting guidance.

    Fixed

    • A failed forced retranslation no longer replaces an existing successful translation. The last valid translation remains available.
    • Corrected the settings-page identifier from wp-btranslate to btranslate.
    • Corrected settings redirects and the Plugins-screen Settings link.
    • Corrected the documented installation directory to wp-content/plugins/btranslate.
    • Fixed release archives to include all required runtime files, localization catalogs, uninstall handling, license, and bilingual WordPress readmes.

    Security

    • Escaped translated plain-text titles and content segments before rendering them as HTML.
    • Sanitized request paths and host headers used by language routing and sitemap resolution.
    • Hardened translation-table queries using the WordPress database preparation APIs.
    • Translation diagnostics no longer write directly to the PHP error log.
    • Added the btranslate_translation_request_logged action for optional sanitized diagnostics.
    • Diagnostic metadata excludes credentials, source and translated text, signatures, and complete provider responses.

    Packaging

    • Added a shared build.sh script for local and CI release packaging.
    • Release builds now:
      • Generate a versioned installable ZIP.
      • Compile and validate the Simplified Chinese .mo catalog.
      • Verify Stable tag consistency.
      • Confirm required runtime files are present.
      • Exclude development-only README files.
    • Updated GitHub Actions to use the shared build script.
    • Tagged builds publish the ZIP as both a workflow artifact and a GitHub Release asset.

    Upgrade Notes

    • No database migration, settings reset, or persisted-translation purge is required.
    • Custom bookmarks or integrations using options-general.php?page=wp-btranslate should be updated to options-general.php?page=btranslate.
    • Sites that relied on translation diagnostics being written directly to the PHP error log should register a handler for btranslate_translation_request_logged.
    • After initial installation or first-time configuration, run Retranslate all content to queue existing content.

    中文

    新增

    • 新增文章、页面、分类和标签翻译失败后的逐项重试功能。
    • 翻译失败的项目会显示在设置页进度条下方,并显示目标语言和“重新翻译”操作。
    • 新增后台界面本地化支持:
      • 默认使用英文。
      • WordPress 语言为 zh_CN 时加载内置简体中文翻译。
    • 新增英文和简体中文 GitHub Issue 表单,包含环境信息和问题复现字段。
    • 新增 WordPress.org 插件元数据、GPL-3.0-only 许可证、插件链接、中英文说明文件,以及百度外部服务和隐私披露。

    改进

    • 将新保存内容及已编辑分类、标签的翻译任务延迟从 30 秒缩短至 10 秒。
    • 现在仅为已发布的文章和页面自动安排翻译,避免草稿及其他未发布状态产生翻译请求。
    • 改进本地化站点地图获取流程:
      • 使用 WordPress 安全 HTTP API。
      • 禁止跟随重定向。
      • 将响应大小限制为 5 MiB。
      • 仅接受成功的 HTTP 响应。
      • 将源站点地图缓存五分钟。
    • 扩充中英文文档,新增以下内容:
      • 百度翻译 API 配置说明。
      • ZIP 手动安装步骤。
      • 语言路由和固定链接配置说明。
      • 翻译失败时的回退行为。
      • 系统要求及问题反馈指引。

    修复

    • 强制重新翻译失败时,不再以失败记录覆盖已有成功译文,最后一次有效译文会继续保留。
    • 将设置页标识从 wp-btranslate 修正为 btranslate
    • 修正设置操作后的跳转地址及插件列表中的“设置”链接。
    • 将文档中的插件安装目录修正为 wp-content/plugins/btranslate
    • 修复发布压缩包内容,确保包含全部运行时文件、语言目录、卸载处理程序、许可证和中英文 WordPress 说明文件。

    安全

    • 在将翻译后的纯文本标题和正文片段输出为 HTML 前进行转义。
    • 清理语言路由和站点地图解析使用的请求路径及主机头。
    • 使用 WordPress 数据库预处理 API 加强翻译数据表查询安全性。
    • 翻译请求诊断不再直接写入 PHP 错误日志。
    • 新增 btranslate_translation_request_logged 动作,用于按需记录经过清理的诊断信息。
    • 诊断信息不包含凭据、原文、译文、签名或完整的服务响应。

    打包

    • 新增本地和 CI 共用的 build.sh 发布构建脚本。
    • 发布构建现在会:
      • 生成带版本号的可安装 ZIP。
      • 编译并校验简体中文 .mo 语言文件。
      • 检查 Stable tag 是否与插件版本一致。
      • 确认必要的运行时文件均已包含。
      • 排除仅用于开发的 README 文件。
    • GitHub Actions 现已统一使用共享构建脚本。
    • 创建版本标签后,ZIP 会同时作为工作流构建产物和 GitHub Release 附件发布。

    升级说明

    • 本次升级不需要执行数据库迁移、重置设置或清理已保存的译文。
    • 使用 options-general.php?page=wp-btranslate 的自定义书签或集成应更新为 options-general.php?page=btranslate
    • 如果站点依赖翻译诊断信息直接写入 PHP 错误日志,需要为 btranslate_translation_request_logged 注册处理程序。
    • 初次安装或首次配置后,请执行“重新翻译所有内容”,为已有内容安排翻译。
    Downloads