worksome / translator
A driver-based translation package for Laravel
Fund package maintenance!
worksome
Installs: 343 246
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 13
Forks: 0
Open Issues: 2
Requires
- php: ^8.2
- google/cloud-translate: ^1.17
- illuminate/support: ^10.0 || ^11.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- guzzlehttp/guzzle: ^7.8
- larastan/larastan: ^2.6
- nunomaduro/collision: ^7.0 || ^8.1
- orchestra/testbench: ^8.0 || ^9.0
- pestphp/pest: ^2.33
- pestphp/pest-plugin-laravel: ^2.2
- worksome/coding-style: ^2.8
This package is auto-updated.
Last update: 2024-11-06 18:53:57 UTC
README
A driver-based translation package for Laravel.
Installation
You can install the package via composer:
composer require worksome/translator
You can publish the config file with:
php artisan vendor:publish --tag="translator-config"
Usage
$translator = new Worksome\Translator\TranslationManager(); $translator->driver('google_cloud_translate')->translate('Text to translate', 'en', 'da'); // TranslationDTO $translator->driver('google_cloud_translate')->detectLanguage('Text to detect'); // DetectedLanguageDTO // Via the Facade use Worksome\Translator\Facades\Translator; Translator::translate(''); // Use the default driver Translator::driver('google_cloud_translate')->translate('', 'en', 'da'); // Use a custom driver
Test suites can utilise the null
driver, this will always return the same string value as provided for translations.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.