2017 © Pedro Peláez
 

package laravel-language-center

Language Center for Laravel.

image

novasa/laravel-language-center

Language Center for Laravel.

  • Wednesday, November 1, 2017
  • by marktopper
  • Repository
  • 3 Watchers
  • 1 Stars
  • 999 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 12 Versions
  • 44 % Grown

The README.md

Laravel Language Center

Language Center for Laravel., (*1)

This requires access to Novasa's Language Center., (*2)

Install

Run composer require novasa/laravel-language-center:~2.0., (*3)

In config/app.php replace Illuminate\Translation\TranslationServiceProvider::class, with Novasa\LaravelLanguageCenter\TranslationServiceProvider::class, in the providers-section., (*4)

Then add the the following environments to your application:, (*5)

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:, (*6)

php artisan vendor:publish --provider="Novasa\LaravelLanguageCenter\TranslationServiceProvider" --tag="config"

Usage

You can use the Laravel standard trans-function., (*7)

trans('header.login');

will return the value of the string id header.login.
However if the string id for header.login does not exists it will return header.login., (*8)

trans('header.welcome_back', [
  'username' => 'Mark',
])

Will return the value of the string id header.welcome_back, but will replace :username with Mark in the translation. However if the string id for header.welcome_back does not exists it will return header.welcome_back., (*9)

trans([
  'key' => 'header.hello_world',
  'string' => 'Hello World!',
])

Will return the value of the string id header.hello_world. However if the string id for header.hello_world does not exists it will return Hello World!., (*10)

trans([
  'key' => 'header.hello_user',
  'string' => 'Hello :username!',
], [
  'username' => 'Mark',
])

Will return the value of the string id header.hello_user, but will replace :username with Mark in the translation. However if the string id for header.hello_user does not exists it will return Hello Mark!., (*11)

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 platorm ios. However if the string id for header.download does not exists it will return You should download our iOS app!., (*12)

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 for footer.copyright does not exists it will return Copyright 2016 Novasa. This will also add a comment to the Language Center., (*13)

Note

If a translation does not exists it will automatically be created at the Language Center., (*14)

Also please note that the locale and local_fallback in the Laravel configurations are overwritten by the settings from the Language Center., (*15)

The Versions

01/11 2017

dev-master

9999999-dev

Language Center for Laravel.

  Sources   Download

MIT

The Requires

 

laravel language center novasa

01/11 2017

v2.0.3

2.0.3.0

Language Center for Laravel.

  Sources   Download

MIT

The Requires

 

laravel language center novasa

01/11 2017

v2.0.2

2.0.2.0

Language Center for Laravel.

  Sources   Download

MIT

The Requires

 

laravel language center novasa

13/10 2017

v2.0.1

2.0.1.0

Language Center for Laravel.

  Sources   Download

MIT

The Requires

 

laravel language center novasa

11/10 2017

dev-analysis-qBQMeL

dev-analysis-qBQMeL

Language Center for Laravel.

  Sources   Download

MIT

The Requires

 

laravel language center novasa

11/10 2017

v2.0.0

2.0.0.0

Language Center for Laravel.

  Sources   Download

MIT

The Requires

 

laravel language center novasa

17/10 2016

v1.0.4

1.0.4.0

Language Center for Laravel.

  Sources   Download

MIT

The Requires

 

laravel language center novasa

17/10 2016

v1.0.3

1.0.3.0

Language Center for Laravel.

  Sources   Download

MIT

The Requires

 

laravel language center novasa

17/10 2016

v1.0.2

1.0.2.0

Language Center for Laravel.

  Sources   Download

MIT

The Requires

 

laravel language center novasa

15/10 2016

v1.0.1

1.0.1.0

Language Center for Laravel.

  Sources   Download

MIT

The Requires

 

laravel language center novasa

15/03 2016

dev-analysis-z3w0aY

dev-analysis-z3w0aY

Language Center for Laravel.

  Sources   Download

MIT

The Requires

 

laravel language center novasa

15/03 2016

v1.0.0

1.0.0.0

Language Center for Laravel.

  Sources   Download

MIT

The Requires

 

laravel language center novasa