Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Auto Translation

Laravel Auto Translation Laravel Package

vildanbina/laravel-auto-translation

Automatically translate Laravel model attributes and language files with a simple trait. Supports multiple drivers like Google, DeepL, and OpenAI, plus caching and queues for fast, seamless multilingual applications.

View on GitHub
Deep Wiki
Context7

Laravel Auto Translation simplifies language localization by automating the translation of JSON and PHP files. It supports drivers like OpenAI, Google Translate, and DeepL. With commands to scan and translate, this package streamlines workflows, making application internationalization efficient and hassle-free.

Frequently asked questions about Laravel Auto Translation
How do I install laravel-auto-translation in a Laravel app?
Install it with composer require vildanbina/laravel-auto-translation, then publish the package config with the vendor:publish command. Add credentials for your chosen driver in the config or environment file, and apply the package trait to a single Eloquent model as a pilot. Because it is opt-in per model, you can scope the rollout to one low-risk content type before expanding.
Which translation drivers does laravel-auto-translation support?
The package supports OpenAI, Google Translate, and DeepL out of the box. Drivers sit behind a contract, so you can swap providers through configuration or add a custom driver if you need a different service. Each driver requires its own API credentials and has its own pricing and quota model, so cost per character at your content volume and locale count is worth checking before rollout.
Does it translate Eloquent model attributes and language files?
Yes. Applying the trait to a model makes its translatable attributes get translated automatically, and the package also ships commands to scan and translate JSON and PHP language files. That covers both database-driven content and static UI strings. Translation happens against a machine-translation provider, so output quality for domain-specific terminology should be reviewed by a human owner.
Does laravel-auto-translation support Laravel 13?
Release 2.2.2 widened the framework constraint to include Laravel 13, which makes it a forward-compatibility patch rather than a feature release. Confirm the patch did not also raise the minimum PHP or Laravel version, since a widened upper bound is safe but a raised floor would strand older apps. Also verify that the transitive provider SDKs your chosen driver depends on are themselves Laravel 13 compatible.
Will automatic translation slow down my model saves?
Default trait usage can perform a synchronous network round-trip to the provider during the save, which inflates write latency and turns a provider outage into a failed save. The package supports queues, and dispatching translation to a queue is strongly recommended for any production workload. With a queue in place, a provider timeout becomes a retried job instead of a user-facing error.
How are translated values stored — JSON column or per-locale?
Storage is configurable. The JSON-column mode stores translations alongside the model and requires no schema migration, while per-locale storage needs migrations and should be chosen up front because switching later is a data-migration task, not a config flip. Consider whether you need to query or sort by translated values, since the storage choice constrains that.
Does the package cache translations to reduce API costs?
Yes, caching is part of the feature set and helps avoid paying for the same string twice, which matters because machine-translation providers bill per character. Combined with queues, caching keeps latency and spend predictable at higher content volumes. Watch for cache invalidation when the source string changes, since a stale cache will keep serving the old translation.
How do I test models that use auto-translation without hitting the provider API?
Bind a fake implementation of the translation driver contract in the service container, or mock the driver, so your test suite never makes real provider calls. Tests should cover the missing-locale and untranslated-fallback paths as well as the happy path, since fallback behavior surfaces at runtime. Keep at least one integration test against a sandbox or low-volume credential to catch provider API changes.
Is it safe to send user-generated content to OpenAI, Google, or DeepL?
Translation transmits your content to a third-party provider, so the gating work is policy rather than engineering: data-egress review, DPA coverage, and cost sign-off. Identify PII-bearing fields and decide whether they need redaction before translation, or whether they should be excluded from the translatable attribute list. Get security and legal sign-off before applying the trait to any user-generated content model.
Is laravel-auto-translation actively maintained, and what are the alternatives?
Release 2.2.2 shows sustained maintenance and forward compatibility, but it is a single-maintainer package, so the bus factor is low; the small surface area mitigates this without eliminating it. For storage-only needs, spatie/laravel-translatable solves a different problem and is often used together with a translation service rather than instead of one. If you need vendor support or a managed translation workflow, a commercial localization platform may fit better.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo