Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benjaminmedia/laravel-translation-provider
Laravel package to implement translations from Translation Manager
https://github.com/benjaminmedia/laravel-translation-provider
Last synced: 28 days ago
JSON representation
Laravel package to implement translations from Translation Manager
- Host: GitHub
- URL: https://github.com/benjaminmedia/laravel-translation-provider
- Owner: BenjaminMedia
- Created: 2017-09-07T13:02:59.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-04-26T08:14:44.000Z (over 2 years ago)
- Last Synced: 2024-12-05T21:06:42.032Z (about 1 month ago)
- Language: PHP
- Size: 24.4 KB
- Stars: 0
- Watchers: 11
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel Translation Provider
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`
```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`
```php
'translation_manager' => [
'url' => env('TRANSLATIONMANAGER_URL'),
'service_id' => env('SERVICE_ID'),
],
```
- Set up in `config/app.php`
```php
'aliases' => [
...,
'BTrans' => \Bonnier\TranslationProvider\Helpers\BTrans::class,
]
```