javaabu/laravel-dhivehi-translate

v0.4.0 2022-06-09 11:58 UTC

This package is auto-updated.

Last update: 2024-10-09 19:12:17 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

Translates Laravel language files to Dhivehi

Installation

You can install the package via composer:

composer require javaabu/laravel-dhivehi-translate

Laravel 5.5 and above uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

After updating composer, add the ServiceProvider to the providers array in config/app.php

Javaabu\LaravelDhivehiTranslate\LaravelDhivehiTranslateServiceProvider::class,

Publish config files

This package essentially creates a Microsoft Translator driver for tanmuhittin/laravel-google-translate package using the InputOutputZ/ATran package. So this package will publish modified versions of config files from those packages named atran.php and laravel_google_translate.php.

php artisan vendor:publish --force --provider="Javaabu\LaravelDhivehiTranslate\LaravelDhivehiTranslateServiceProvider"

Add Microsoft Azure Translation API Key to .env

AZURETRAN_KEY=xxxxxxxxxxxxxx

Follow this link to get API key.

Usage

Then you can run

php artisan translate:files

See it on action:

laravel-google-translate

Str facade api-translation helpers

This package provides two translation methods for Laravel helper Str

  • Illuminate\Support\Str::apiTranslate -> Translates texts using your selected api in config
  • Illuminate\Support\Str::apiTranslateWithAttributes -> Again translates texts using your selected api in config in addition to that this function respects Laravel translation text attributes like :name

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email info@javaabu.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.