Skip to content

Commit

Permalink
InvoiceExtension: lang in config
Browse files Browse the repository at this point in the history
  • Loading branch information
AntikCz committed Mar 3, 2016
1 parent 52f18b5 commit c0e063e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ extensions:
invoice: WebChemistry\Invoice\DI\InvoiceExtension

invoice:
lang: en
company:
name:
town:
Expand Down
4 changes: 3 additions & 1 deletion src/DI/InvoiceExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class InvoiceExtension extends CompilerExtension {
'zip' => NULL,
'country' => NULL
],
'lang' => 'en'
];

public function loadConfiguration() {
Expand All @@ -37,7 +38,8 @@ public function loadConfiguration() {
->setClass('WebChemistry\Invoice\Data\Template');

$builder->addDefinition($this->prefix('invoice'))
->setClass('WebChemistry\Invoice\Invoice', [$this->prefix('@company'), $this->prefix('@template')]);
->setClass('WebChemistry\Invoice\Invoice', [$this->prefix('@company'), $this->prefix('@template')])
->addSetup('?->getTranslator()->setLang(?)', ['@self', $config['lang']]);
}

}

0 comments on commit c0e063e

Please sign in to comment.