lsv/google-translation-bundle
A Symfony bundle that integrates Google Translate into your application, letting you translate text and content between languages through a simple service layer. Useful for building multilingual sites with automatic translation of dynamic content.
Require the package and its underlying translator: composer require lsv/google-translate-bundle. In a Laravel app you are effectively installing the stichoza/google-translate-php library that this bundle wraps; the bundle layer itself is Symfony-specific glue.
Look first at the bundle's Resources/config/services.* and its DependencyInjection/Configuration to see what translator object it constructs and which defaults (source/target locale, timeout) it applies. That tells you what you need to replicate in Laravel.
First use case: translate a single string. In practice, register the underlying translator in a service provider and resolve it:
// AppServiceProvider::register()
$this->app->singleton(\Stichoza\GoogleTranslate\GoogleTranslate::class, fn () => new \Stichoza\GoogleTranslate\GoogleTranslate('en', 'fr'));
app(\Stichoza\GoogleTranslate\GoogleTranslate::class)->translate('Hello');
translate() in Cache::remember("translate:{$locale}:".md5($text), ...). Translation calls are the slow, quota-consuming part; identical strings are common in UI copy.ShouldQueue) with retry/backoff to absorb rate-limit and transient network errors instead of blocking requests.getLastDetectedSource() (or detect()) is useful for user-submitted content before choosing a target locale.config/services.php (e.g. google_translate.source, target, timeout) and inject them into your service provider rather than hardcoding.Translator class with translate() / translateBatch() methods and a facade so app code doesn't depend on the vendor API surface directly — this makes swapping to the official Cloud Translation client later trivial.stichoza/google-translate-php library directly.google/cloud-translate and treat this package as a prototype shortcut.Too many requests) instead. Add generous retries and backoff.How can I help you explore Laravel packages today?