From d49743031f456c596625cb83e2c2d692fc4684b7 Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 27 Jul 2020 07:13:39 +0200 Subject: [PATCH] Add windows locale support #3519 --- app/Support/Amount.php | 5 +++-- app/Support/Steam.php | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Support/Amount.php b/app/Support/Amount.php index b4a64337f5..cb3769634d 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -121,7 +121,7 @@ class Amount */ public function getJsConfig(): array { - $config = $this->getLocaleInfo(); + $config = $this->getLocaleInfo(); $negative = self::getAmountJsConfig($config['n_sep_by_space'], $config['n_sign_posn'], $config['negative_sign'], $config['n_cs_precedes']); $positive = self::getAmountJsConfig($config['p_sep_by_space'], $config['p_sign_posn'], $config['positive_sign'], $config['p_cs_precedes']); @@ -147,6 +147,7 @@ class Amount setlocale(LC_MONETARY, $array); $info = localeconv(); + // correct variables $info['n_cs_precedes'] = $this->getLocaleField($info, 'n_cs_precedes'); $info['p_cs_precedes'] = $this->getLocaleField($info, 'p_cs_precedes'); @@ -154,7 +155,7 @@ class Amount $info['n_sep_by_space'] = $this->getLocaleField($info, 'n_sep_by_space'); $info['p_sep_by_space'] = $this->getLocaleField($info, 'p_sep_by_space'); - $fmt = new NumberFormatter( $locale, NumberFormatter::CURRENCY ); + $fmt = new NumberFormatter( $locale, NumberFormatter::CURRENCY); $info['mon_decimal_point'] = $fmt->getSymbol(NumberFormatter::MONETARY_SEPARATOR_SYMBOL); $info['mon_thousands_sep'] = $fmt->getSymbol(NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL); diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 4b3a319346..cfba55c83c 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -625,6 +625,7 @@ class Steam return [ sprintf('%s.utf8', $locale), sprintf('%s.UTF-8', $locale), + str_replace('_', '-', $locale), // for Windows. ]; }