Skip to main content
Version: 2.0.0

Developer / Console & MCP

Console commands

i18n registers two console controllers under i18n/*, aimed at running translations from cron or CI instead of the CP.

i18n/translate/*

CommandDescription
php craft i18n/translate/queueQueues a translation batch using the plugin's global settings (sectionIds, sourceSiteId/targetSiteId, provider, etc. — see Settings) and runs the queue immediately. This is the command to put on a cron schedule for "keep translating whatever is new".
php craft i18n/translate/run-job <id>Queues one specific, enabled translation job by ID.
php craft i18n/translate/run-all [provider]Queues every enabled, not-yet-complete job. Pass provider to only queue jobs using that provider handle.
php craft i18n/translate/listLists all saved translation jobs with their source/target section, source/target site, provider and enabled state.
php craft i18n/translate/show <id>Prints full detail for one job: sections, sites, languages, provider (and fallback sequence), fields/field mappings, entry limit, safety flags, and its entry condition (as JSON).
php craft i18n/translate/delete <id>Deletes a job definition.
php craft i18n/translate/duplicate <id> [name]Clones a job (new ID, statistics reset); optional new name, otherwise <original name> (copy).
php craft i18n/translate/stats [provider]Prints the statistics snapshot (queued/completed/errors/skipped/blocked) for every job, or only jobs using the given provider.
php craft i18n/translate/clear-snapshot <id>Clears the statistics snapshot for one job.
php craft i18n/translate/clear-snapshots [provider]Clears statistics snapshots for all jobs, or only jobs using the given provider.
php craft i18n/translate/enable-statistics [target]Enables statistics logging. target can be a job ID or a provider handle; omitted, it applies to all jobs.
php craft i18n/translate/disable-statistics [target]Same as above, but disables statistics logging.

Example cron entry that keeps a store's secondary-language site translated every 15 minutes:

*/15 * * * * cd /path/to/craft && php craft i18n/translate/queue >> storage/logs/i18n-cron.log 2>&1

i18n/statistics/*

CommandOptionsDescription
php craft i18n/statistics/send-digest--frequency/-f (hourly|two-hourly|daily), --forceQueues the translation statistics digest email. Without --force, it respects the configured digestFrequency window (won't re-send before the window elapses); --force sends regardless.

MCP tools

When the craft-mcp plugin is installed, i18n registers four MCP tools (via McpPlugin::EVENT_REGISTER_TOOLS), so an MCP client (an AI agent connected to the Craft install) can inspect and drive translation jobs without CP access:

Tool nameDescription
i18n_list_jobsLists all configured translation jobs with source/target language, provider, and enabled state.
i18n_get_statisticsGets translation statistics. Omit job_id for global statistics across all jobs, or pass it for one job's entry counts, translated/remaining totals and blocked entries.
i18n_run_jobQueues a translation job for execution. The job runs asynchronously via the Craft queue; use i18n_get_status to track progress.
i18n_get_statusGets per-entry translation status rows (translated, blocked, errored). Filterable by job_id, with limit/page pagination.

If craft-mcp is not installed, i18n's MCP tool registration is skipped silently — the CP and console commands work the same either way.

Permissions

i18n does not register a dedicated Craft CP user permission. Its full CP section (Dashboard, Translate jobs, Statistics, Status, Logs) is only shown to users who are both a Craft admin and have allowAdminChanges enabled in config/general.php; other users only see the plugin's Settings entry.

Extensibility

i18n does not currently expose its own public plugin events (e.g. before/after translate) for third-party code to hook into — extension points are the console commands and the MCP tools above, plus the entry condition and field mapping options already available on a job. Translation providers (src/services/providers/*) are internal to the plugin and are not designed to be replaced or extended from outside the plugin.