Moved default language, default timezone and base currency settings to new settings system

This commit is contained in:
Jan Böhmer 2024-08-03 23:14:29 +02:00
parent 463812fb3d
commit 2ab2b7f77d
27 changed files with 211 additions and 83 deletions

View file

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace App\Services\Formatters;
use App\Entity\PriceInformations\Currency;
use App\Settings\SystemSettings\LocalizationSettings;
use Locale;
use NumberFormatter;
@ -30,7 +31,7 @@ class MoneyFormatter
{
protected string $locale;
public function __construct(protected string $base_currency)
public function __construct(private readonly LocalizationSettings $localizationSettings)
{
$this->locale = Locale::getDefault();
}
@ -45,7 +46,7 @@ class MoneyFormatter
*/
public function format(string|float $value, ?Currency $currency = null, int $decimals = 5, bool $show_all_digits = false): string
{
$iso_code = $this->base_currency;
$iso_code = $this->localizationSettings->baseCurrency;
if ($currency instanceof Currency && ($currency->getIsoCode() !== null && $currency->getIsoCode() !== '')) {
$iso_code = $currency->getIsoCode();
}