msns/module-product-translation

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

Maintainers

Package info

gitlab.com/msns1/module-product-translation

Issues

Type:magento2-module

pkg:composer/msns/module-product-translation

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

v1.0.0 2026-06-24 13:50 UTC

This package is auto-updated.

Last update: 2026-06-24 11:56:46 UTC


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.