| Package Data | |
|---|---|
| Maintainer Username: | marktopper | 
| Package Create Date: | 2016-03-15 | 
| Package Last Update: | 2022-10-06 | 
| Home Page: | http://novasa.com | 
| Language: | PHP | 
| License: | MIT | 
| Last Refreshed: | 2025-10-31 03:02:03 | 
| Package Statistics | |
|---|---|
| Total Downloads: | 19,061 | 
| Monthly Downloads: | 0 | 
| Daily Downloads: | 0 | 
| Total Stars: | 0 | 
| Total Watchers: | 1 | 
| Total Forks: | 0 | 
| Total Open Issues: | 0 | 
Language Center for Laravel.
This requires access to Novasa's Language Center.
Run composer require novasa/laravel-language-center:~2.0.
In config/app.php replace Illuminate\Translation\TranslationServiceProvider::class, with Novasa\LaravelLanguageCenter\TranslationServiceProvider::class, in the providers-section.
Then add the the following environments to your application:
LANGUAGE_CENTER_URL=The url for API v1 (with ending slash) (required)
LANGUAGE_CENTER_USERNAME=Language Center username for Basic Auth (required)
LANGUAGE_CENTER_PASSWORD=Language Center password for Basic Auth (required)
LANGUAGE_CENTER_PLATFORM=The default platform to use. (default 'web')
LANGUAGE_CENTER_UPDATE_AFTER=The amount of seconds before updating the LanguageCenter data. (default '60' seconds)
For publishing the configuration file run:
php artisan vendor:publish --provider="Novasa\LaravelLanguageCenter\TranslationServiceProvider" --tag="config"
You can use the Laravel standard trans-function.
trans('header.login');
will return the value of the string id
header.login.
However if the string id forheader.logindoes not exists it will returnheader.login.
trans('header.welcome_back', [
  'username' => 'Mark',
])
Will return the value of the string id
header.welcome_back, but will replace:usernamewithMarkin the translation. However if the string id forheader.welcome_backdoes not exists it will returnheader.welcome_back.
trans([
  'key' => 'header.hello_world',
  'string' => 'Hello World!',
])
Will return the value of the string id
header.hello_world. However if the string id forheader.hello_worlddoes not exists it will returnHello World!.
trans([
  'key' => 'header.hello_user',
  'string' => 'Hello :username!',
], [
  'username' => 'Mark',
])
Will return the value of the string id
header.hello_user, but will replace:usernamewithMarkin the translation. However if the string id forheader.hello_userdoes not exists it will returnHello Mark!.
trans([
  'key' => 'header.download',
  'string' => 'You should download our iOS app!',
  'platform' => 'ios',
])
Will return the value of the string id
header.download, but for the platormios. However if the string id forheader.downloaddoes not exists it will returnYou should download our iOS app!.
trans([
  'key' => 'footer.copyright',
  'string' => 'Copyright 2016 Novasa',
  'comment' => 'A comment that you would like to show at the Language Center.',
])
Will return the value of the string id
footer.copyright. However if the string id forfooter.copyrightdoes not exists it will returnCopyright 2016 Novasa. This will also add a comment to the Language Center.
If a translation does not exists it will automatically be created at the Language Center.
Also please note that the locale and local_fallback in the Laravel configurations are overwritten by the settings from the Language Center.