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

Translate Laravel Package

mouyong/translate

A Laravel/PHP translation package that simplifies adding multilingual support. It offers configurable translation services and a clean API for translating text or language files, making localization easy to integrate into existing applications.

View on GitHub
Deep Wiki
Context7

文本语言识别,文本内容翻译,集成百度翻译、有道云翻译、谷歌翻译、金山词霸翻译

Frequently asked questions about Translate
How do I install and configure mouyong/translate in a Laravel application?
Install it with Composer and let Laravel's package auto-discovery register the service provider, then publish the package config file so you can supply credentials. Each translation driver reads its own key and secret settings from that config, so you only need to fill in the providers you actually intend to use. After that, resolve the translator through the container and call the translate API from your own service class rather than from controllers.
Which Laravel and PHP versions does mouyong/translate support?
The package targets Laravel 9/10-era applications running PHP 8.x and follows conventional Laravel packaging conventions such as a service provider and publishable config. Because it is a thin wrapper, it assumes Laravel's container and config system are present. Verify the supported version range against your exact framework version before committing, since the release cadence is low and newer Laravel majors may not be declared as tested.
Which translation providers does mouyong/translate support?
It ships four backend drivers: Baidu Translate, Youdao Cloud translation, Google Translate, and Kingsoft PowerWord. Provider selection is configuration rather than a code change, which is the main architectural benefit of the package. Treat provider coverage as something to verify yourself, because third-party APIs change auth schemes and endpoints over time and older integrations in a low-traffic package can go stale.
Do I need a China-registered developer account to use the translation drivers?
Baidu, Youdao, and Kingsoft generally require a China-registered developer account with provider-specific request signing. Google requires a Google Cloud project with billing enabled. All four are paid or quota-metered services, so budget procurement and key management time alongside the roughly one day of integration wiring.
Is mouyong/translate free for commercial and proprietary applications?
The package is licensed under LGPL-3.0, not MIT, which is the most consequential thing to check before shipping it in a closed-source product. LGPL obligations are ambiguous for a PHP library that is vendored and distributed as source, and many organizations maintain an LGPL denylist. Get legal review covering your distribution model, since SaaS delivery and shipped on-prem software carry different implications.
Does mouyong/translate cache translations or manage Laravel language files?
No. The package provides an on-demand translate primitive; it does not store, queue, or cache results, and it is not a full localization pipeline with message catalogs, pluralization, or glossaries. If you need caching or persisted language files, add that in your own adapter layer around the package. This keeps the package small but means production concerns like rate limiting and cache invalidation are yours to implement.
How accurate is the language detection in mouyong/translate?
Language detection is bundled as a package capability, but the accuracy characteristics per provider are not documented. Treat detection quality as a validation task rather than a coding task: test it against your real content, including short strings, mixed-language text, and user-generated input. For short or ambiguous strings, you may need your own confidence threshold before trusting the detected language.
Can I switch translation providers without changing application code?
Yes, the driver-based design makes provider selection configuration rather than code. The safest pattern is to define your own translator interface in your application, with methods such as detect and translate, and implement it with this package as the backing adapter. That way provider swaps, fallbacks on provider failure, and eventual replacement of the package do not touch call sites in controllers or models.
Is mouyong/translate actively maintained and tested?
Signals are thin: roughly 96 stars and a release cadence with one release in mid-2024. Before adopting, check commit history, open-issue response time, and whether breaking provider API changes have been addressed. Also look for a test suite or CI that exercises live or mocked provider calls, since a wrapper around four third-party APIs carries continuous maintenance liability.
What are the alternatives to mouyong/translate for translating text in Laravel?
If you only need static message catalogs, Laravel's built-in localization with lang files is simpler and dependency-free. For dynamic text translation, many teams call a single provider's official SDK, such as Google Cloud Translation v3 or a commercial API like DeepL, behind their own interface. That avoids the LGPL licensing question and the maintenance risk of tracking four provider integrations at once.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console