Skip to content

A driver-based translation package for Laravel.

License

Notifications You must be signed in to change notification settings

worksome/translator

Repository files navigation

Translator

Latest Version on Packagist GitHub Tests Action Status GitHub PHPStan Action Status Total Downloads

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.

About

A driver-based translation package for Laravel.

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages