Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ $isoCodes = new IsoCodesFactory(null, new GettextExtensionDriver());

// symfony driver
$driver = new SymfonyTranslationDriver();

// You can also specify a cache directory for better performance. If you are
// using the SymfonyTranslationDriver within a Symfony project, you can inject
// the `%kernel.cache_dir%/translations` value.
$cacheDir = '...';

$driver = new SymfonyTranslationDriver($cacheDir)

$driver->setLocale('uk_UA');

$isoCodes = new IsoCodesFactory(
Expand Down
4 changes: 2 additions & 2 deletions src/TranslationDriver/SymfonyTranslationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class SymfonyTranslationDriver implements TranslationDriverInterface
*/
private $locale = 'en';

public function __construct()
public function __construct(?string $cacheDirectory = null)
{
$this->translator = new Translator($this->locale);
$this->translator = new Translator($this->locale, null, $cacheDirectory);
$this->translator->addLoader('mo', new MoFileLoader());
}

Expand Down