bonnier / laravel-translation-provider
Laravel package to implement translations from Translation Manager
Installs: 141
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 11
Forks: 0
Open Issues: 0
Type:laravel-package
Requires
- bonnier/context-laravel: ^2.0
- guzzlehttp/guzzle: ^7.0
- illuminate/console: ^7.0
- illuminate/http: ^7.0
- illuminate/support: ^7.0
- laravel/framework: ^7.0
This package is auto-updated.
Last update: 2024-11-26 13:26:27 UTC
README
Laravel package that retrieves translations strings from Translation Manager and makes them available for Laravel translation functions.
Usage
To use the translator call
Btrans::translate($key, $replace, $locale)
instead of
trans($key, $replace, $locale)
Add translation
To add a translation, run:
php artisan bonnier:translation:add "translation-key" "Translation value"
Update translation
To update an exisiting translations, run:
php artisan bonnier:translation:update "translation-key" "Translation value"
Delete translation
To delete an existing translation, run: VERY DESTRUCTIVE
php artisan bonnier:translation:delete "translation-key"
Getting translations
To get all translations from Translation Manager, run:
php artisan bonnier:translation:get
Setup
composer require bonnier/laravel-translation-provider
- Register the provider in config/app.php`
... 'providers' => [ ... Bonnier\TranslationProvider\TranslationServiceProvider::class, ],
- Setup configuration in
.env
SERVICE_ID=1
TRANSLATIONMANAGER_URL=http://url-to-translationmanager.com
- Set up in
config/services.php
'translation_manager' => [ 'url' => env('TRANSLATIONMANAGER_URL'), 'service_id' => env('SERVICE_ID'), ],
- Set up in
config/app.php
'aliases' => [ ..., 'BTrans' => \Bonnier\TranslationProvider\Helpers\BTrans::class, ]