Skip to content

Commit

Permalink
price by request
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-volodin committed Feb 21, 2020
1 parent d75a9db commit 1615f06
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Price/PriceFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public function __construct(ServiceProviderInterface $twigProvider)
*/
public function format($price, array $options = []): string
{
if (!isset($options['format']['value'])) {
$options['format']['value'] = 'default';
if (!isset($options['format'])) {
$options['format'] = 'default';
}
if (!isset($options['format']['empty'])) {
$options['format']['empty'] = 'default';
if (!isset($options['empty_format'])) {
$options['empty_format'] = 'default';
}

return $this->getTwig()->render(isset($options['template']) ? $options['template'] : '@DarvinUtils/price.html.twig', [
Expand Down
2 changes: 1 addition & 1 deletion Resources/translations/messages.ar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ flash:
error:
form: 'شكل الأخطاء المكتشفة. اصلاحها وإعادة تشكيل'
price:
format:
value:
default: AED %price%
empty:
default: 'السعر عند الطلب'
2 changes: 1 addition & 1 deletion Resources/translations/messages.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ flash:
form: Form Errors Detected. Fix Them and Resubmit Form

price:
format:
value:
default: $%price%
empty:
default: 'Price on request'
2 changes: 1 addition & 1 deletion Resources/translations/messages.fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ flash:
error:
form: 'Des Erreurs Détectées. Les corriger et de soumettre à nouveau le Formulaire'
price:
format:
value:
default: '%price% €'
empty:
default: 'Prix sur demande'
2 changes: 1 addition & 1 deletion Resources/translations/messages.ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ flash:

price:
value:
default: '%price% руб.'
default: '%price% '
empty:
default: 'По запросу'
2 changes: 1 addition & 1 deletion Resources/translations/messages.zh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ flash:
error:
form: '形成的错误检测。 解决这些问题,并重新提交形式'
price:
format:
value:
default: ¥%price%
empty:
default: '价格要求'
4 changes: 2 additions & 2 deletions Resources/views/price.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% if price > 0 %}
{{ ('price.value.' ~ options.format.value)|trans({'%price%': price|number_format(0, null, ' ')})|raw }}
{{ ('price.value.' ~ options.format)|trans({'%price%': price|number_format(0, null, ' ')})|raw }}
{% else %}
{{ ('price.empty.' ~ options.format.empty)|trans|raw }}
{{ ('price.empty.' ~ options.empty_format)|trans|raw }}
{% endif %}

0 comments on commit 1615f06

Please sign in to comment.