https://github.com/benjaminmedia/system-text-provider
Laravel package to implement system text translations from external service
https://github.com/benjaminmedia/system-text-provider
Last synced: about 1 year ago
JSON representation
Laravel package to implement system text translations from external service
- Host: GitHub
- URL: https://github.com/benjaminmedia/system-text-provider
- Owner: BenjaminMedia
- Created: 2017-08-17T11:48:36.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-22T12:50:47.000Z (almost 9 years ago)
- Last Synced: 2025-03-26T14:54:34.839Z (about 1 year ago)
- Language: PHP
- Size: 5.86 KB
- Stars: 0
- Watchers: 10
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# System Text Provider
Laravel package that retrieves translations strings from Bonnier microsoervice and extends the laravel __() localization function.
## Setup
- ```composer require bonnier/system-text-provider```
- Register the provider in ```config/app.php```
```php
...
'providers' => [
...
Bonnier\SystemText\SystemTextProvider::class,
],
```
- Setup configuration in ```config/services.php```
```php
'systemtext' => [
'sitemanager' => '{url/to/sitemanager}',
'microservice' => '{url/to/system-text-service}',
]
```
## Get translations
- run ```php artisan bonnier:fetch [--force]```
## Use translations
Use Laravels own translation helper functions ( ``__('key')`` and ``trans('key')`` ) with the following structure:
``echo __('bonnier::{appcode}/{brandcode}/messages.{translation_key}');`` => ``echo __('bonnier::brand_site/gds/messages.welcome');``