elgentos/magento2-untranslated-strings 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

elgentos/magento2-untranslated-strings

最新稳定版本:1.0.0

Composer 安装命令:

composer require elgentos/magento2-untranslated-strings

包简介

Detects untranslated strings at runtime, reports them in an admin grid and translates them with Claude (Anthropic API) through the message queue.

README 文档

README

Magento 2 module that detects untranslated strings at runtime, reports them in an admin grid and can translate them automatically with Claude (Anthropic API) through Magento's message queue.

A spiritual successor to the Magento 1 extension EW_UntranslatedStrings.

How it works

  1. Detect — a plugin on Magento\Framework\Phrase\Renderer\Translate checks every rendered phrase against the loaded translation dictionary (i18n CSVs, theme translations and database translations) for the current store locale. Strings without a translation are buffered per request and flushed to the database in a single query at shutdown.
  2. Report — findings appear under Reports → Untranslated Strings: filterable, sortable and exportable, with occurrence counts, store view, locale and the URL where the string was first seen.
  3. Translate — select rows and use the Translate with Claude mass action. The rows are queued (Magento message queue, DB transport — no RabbitMQ required) and a consumer sends them to the Anthropic API in batches. Successful translations are written to Magento's native translation database table (store-scoped) and go live after the automatically-invalidated translate / full_page caches are refreshed. Failed rows get status Error with the error message in the grid; re-select them to retry.

Installation

composer require elgentos/magento2-untranslated-strings
bin/magento module:enable Elgentos_UntranslatedStrings
bin/magento setup:upgrade

Configuration

Stores → Configuration → Advanced → Untranslated Strings

Setting Scope Description
Log Untranslated Strings store view Enables runtime detection. Off by default.
Anthropic API Key global Encrypted. Create one at console.anthropic.com.
Claude Model global Defaults to claude-opus-4-8.

Detection adds a small overhead per rendered phrase — enable it per store view, ideally on development or staging while you browse/crawl the shop, then review the report.

The queue consumer

Translation runs asynchronously through the consumer elgentosUntranslatedStringsTranslate. With Magento's default consumers_runner cron configuration it starts automatically. To run it manually:

bin/magento queue:consumers:start elgentosUntranslatedStringsTranslate

Notes

  • Translations are stored in the core translation table, so they survive deployments and can be reviewed/edited with any DB-translation tooling.
  • The Claude prompt instructs the model to preserve placeholders (%1%9, %s, %d, named placeholders), HTML and punctuation, and to keep brand/product names untranslated. Structured output (JSON schema) guarantees a parseable response.
  • Detection never breaks rendering: all failure paths are caught and logged.

License

MIT

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固