2017 © Pedro Peláez
 

library saxulum-translation-provider

Saxulum Translation Provider (yaml)

image

saxulum/saxulum-translation-provider

Saxulum Translation Provider (yaml)

  • Friday, April 20, 2018
  • by dominikzogg
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5,566 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 14 Versions
  • 15 % Grown

The README.md

saxulum-translation-provider

works with plain silex-php, (*1)

Build Status Total Downloads Latest Stable Version Scrutinizer Code Quality, (*2)

Features

  • Register translations

Requirements

  • php >=5.3
  • Symfony Config Component >=2.3
  • Symfony Finder Component >=2.3
  • Symfony Translation Component >=2.3
  • Symfony Yaml Component >=2.3

Installation

Through Composer as [saxulum/saxulum-translation-provider][1]., (*3)

Preparation (for non silex users)

Debug value is needed

```{.php} $container['debug'] = true; // or false, (*4)


##### Define translator service ```{.php} use Symfony\Component\Translation\Translator; $container['translator'] = function () { return new Translator('en'); };

Or if you load silex/silex as a dependency you can also use the TranslationServiceProvider., (*5)

```{.php} use Silex\Provider\TranslationServiceProvider;, (*6)

$container['locale'] = 'en'; $container->register(new TranslationServiceProvider());, (*7)


#### For all users ##### With translation cache (faster) ```{.php} use Saxulum\Translation\Silex\Provider\TranslationProvider; $container->register(new TranslationProvider(), array( 'translation_cache' => '/path/to/cache' ));
  • debug == true: the cache file will be build at each load
  • debug == false: the cache file will be build if not exists, delete it if its out of sync
Without translation cache (slower)

```{.php} use Saxulum\Translation\Silex\Provider\TranslationProvider;, (*8)

$container->register(new TranslationProvider());, (*9)



Usage ----- #### Add the translation paths ```{.php} $container['translation_paths'] = $container->extend('translation_paths', function ($paths) { $paths[] = '/path/to/the/translations'; return $paths; });

Usage with Twig templates

To get access to the |trans filter in Twig templates, you must register the translator first and then add the TwigServiceProvider from silex/silex. You will also have to require the symfony/twig-bridge package., (*10)

```{.php} use Silex\Provider\TwigServiceProvider;, (*11)

$this->register(new TwigServiceProvider(), [ 'twig.path' => array(DIR.'/../views'), 'twig.options' => array('cache' => $cacheDir), ]); ```, (*12)

The Versions

20/04 2018

v1.x-dev

1.9999999.9999999.9999999-dev

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum

28/04 2016

1.2.0

1.2.0.0

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum

28/04 2016

dev-master

9999999-dev

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum

28/04 2016

2.2.0

2.2.0.0

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum

19/12 2015

1.1.1

1.1.1.0

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum

19/12 2015

2.1.1

2.1.1.0

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum

19/12 2015

2.1.0

2.1.0.0

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum

19/12 2015

1.1.0

1.1.0.0

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum

10/10 2014

2.0.1

2.0.1.0

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum

09/10 2014

2.0.0

2.0.0.0

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum

09/10 2014

1.0.4

1.0.4.0

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum

30/01 2014

1.0.3

1.0.3.0

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum

30/01 2014

1.0.1

1.0.1.0

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum

29/01 2014

1.0.0

1.0.0.0

Saxulum Translation Provider (yaml)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dominik Zogg

silex translation yaml pimple cilex saxulum