定制 msns/module-product-translation 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

msns/module-product-translation

Composer 安装命令:

composer require msns/module-product-translation

包简介

AI translation of product attributes across store views (configurable endpoint/model).

README 文档

README

AI translation of product attributes across store views for Magento 2, using any OpenAI-compatible chat endpoint (OpenAI, Mistral, OpenRouter, Ollama, LM Studio, a gateway…).

Translate name, description, short_description (configurable) from a source store view into all the others. A tracking table records when each product/store was translated and automatically flags it stale when the source content changes.

Features

  • Configurable endpoint, API key and model — no SDK, no provider lock-in.
  • Source store → all other store views; target language derived from each store's locale.
  • Per-(product, store) tracking: translated_at + status (pending / translated / stale / error).
  • Stale detection on source change only: editing a product on the source store re-flags its translations; editing a translated store view does not.
  • Run it three ways: a button on the product page (AJAX modal, live progress), a CLI command, or a cron (every 5 min).

Requirements

  • Magento 2.4.x, PHP 8.2+
  • An OpenAI-compatible chat-completions endpoint

Installation

composer require msns/module-product-translation
bin/magento module:enable Msns_ProductTranslation
bin/magento setup:upgrade

Or drop the module into app/code/Msns/ProductTranslation and run setup:upgrade.

Configuration

Stores → Configuration → MSNS → Product Translation

FieldDescription
EnabledMaster switch
Source store viewThe store whose content is translated into the others
Attributes to translateComma-separated attribute codes (default name,description,short_description)
Prompt templatePlaceholders: {{attribute}} {{language}} {{text}} {{product_name}}
API URLOpenAI-compatible endpoint, e.g. https://api.openai.com/v1/chat/completions
API keyStored encrypted; ignored by providers that don't require auth (Ollama/LM Studio)
Modele.g. gpt-4o-mini, mistral-small, llama3.1, or any locally loaded model

Inside Docker, point the URL at http://host.docker.internal:<port>/... to reach a model running on the host.

Usage

Product page — click Translate to all stores. A modal shows per-store progress and the result.

CLI

bin/magento msns:translate --seed     # queue every product × target store
bin/magento msns:translate --limit 50 # translate a batch of pending/stale rows

Cronmsns_product_translation_run processes pending/stale rows every 5 minutes.

How staleness works

On catalog_product_save_after, the module hashes the configured attributes at the source store scope. If that hash differs from the one stored at translation time, the product's translated rows are marked stale. A change on a target store view leaves the source hash untouched, so it never re-flags — only the source store matters.

Testing

composer install
vendor/bin/phpunit

CI (.gitlab-ci.yml) runs the unit suite on every push.

License

Proprietary.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-06-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固