2017 © Pedro Peláez
 

library symfony-translation-provider

A league/container v2 service provider for Symfony's translation component.

image

laasti/symfony-translation-provider

A league/container v2 service provider for Symfony's translation component.

  • Thursday, April 21, 2016
  • by nebulousGirl
  • Repository
  • 1 Watchers
  • 1 Stars
  • 241 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 7 Versions
  • 4 % Grown

The README.md

Laasti/symfony-translation-provider

A league/container v2 service provider for Symfony's translation component., (*1)

Installation

composer require laasti/symfony-translation-provider

Usage


$container = new League\Container\Container; $container->addServiceProvider('Laasti\SymfonyTranslationProvider\SymfonyTranslationProvider'); $container->add('config.translation', [ //Two-letter or four-letter locales are accepted 'locale' => 'en', //When a message is not found in the locale, look in those too 'fallback_locales' => ['en'], 'message_selector_class' => 'Symfony\Component\Translation\MessageSelector', //Symfony's package offers many different loaders 'loaders' => [ 'array' => 'Symfony\Component\Translation\Loader\ArrayLoader', 'json' => 'Symfony\Component\Translation\Loader\JsonFileLoader' ], 'resources' => [ 'en' => [ //The first item is the loader to use, the second the resource the loader will use ['array', ['hello_world' => 'Hello']] //The third item in array is the resource's domain //Sseful to namespace messages, defaults to messages ['json', 'my-json-file.json', 'forms'] ] ], ]); $translator = $container->get('Symfony\Component\Translation\Translator'); $translator->trans('hello_world); //returns "Hello"

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

History

See Github's releases, or tags, (*2)

Credits

Author: Sonia Marquette (@nebulousGirl), (*3)

License

Released under the MIT License. See LICENSE.txt file., (*4)

The Versions

21/04 2016

dev-master

9999999-dev

A league/container v2 service provider for Symfony's translation component.

  Sources   Download

MIT

The Requires

 

21/04 2016

v2.0.1

2.0.1.0

A league/container v2 service provider for Symfony's translation component.

  Sources   Download

MIT

The Requires

 

21/02 2016

v2.0.0

2.0.0.0

A league/container v2 service provider for Symfony's translation component.

  Sources   Download

MIT

The Requires

 

22/12 2015

dev-v1-dev

dev-v1-dev

A league/container service provider for Symfony's translation component.

  Sources   Download

MIT

The Requires

 

22/12 2015

v1.1.1

1.1.1.0

A league/container service provider for Symfony's translation component.

  Sources   Download

MIT

The Requires

 

02/11 2015

v1.1

1.1.0.0

A league/container service provdier for Symfony's translation component.

  Sources   Download

MIT

The Requires

 

29/08 2015

v1.0

1.0.0.0

A league/container service provdier for Symfony's translation component.

  Sources   Download

MIT

The Requires