Skip to content

Commit 4ed7ab6

Browse files
committed
ACP2E-1012: No space between a custom currency symbol and a price
1 parent 0da49bd commit 4ed7ab6

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

app/code/Magento/Directory/Model/Currency.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -432,16 +432,6 @@ private function formatCurrency(string $price, array $options): string
432432
$this->getCode() ?? $this->numberFormatter->getTextAttribute(\NumberFormatter::CURRENCY_CODE)
433433
);
434434

435-
if (array_key_exists(LocaleCurrency::CURRENCY_OPTION_SYMBOL, $options)) {
436-
// remove non-breaking space from custom currency code and allow custom NBSP in currency code
437-
$formattedCurrency = preg_replace('/( |&nbsp|\xc2\xa0)*/iu', '', $formattedCurrency);
438-
439-
if (!array_key_exists(LocaleCurrency::CURRENCY_OPTION_DISPLAY, $options)) {
440-
// remove non-breaking space when `display` is not set explicitly
441-
$formattedCurrency = str_replace(' ', '', $formattedCurrency);
442-
}
443-
}
444-
445435
if ((array_key_exists(LocaleCurrency::CURRENCY_OPTION_DISPLAY, $options)
446436
&& $options[LocaleCurrency::CURRENCY_OPTION_DISPLAY] === \Magento\Framework\Currency::NO_SYMBOL)) {
447437
$formattedCurrency = str_replace(' ', '', $formattedCurrency);

app/code/Magento/Directory/Test/Unit/Model/CurrencyTest.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,21 +227,14 @@ public function getFormatTxtNumberFormatterDataProvider(): array
227227
],
228228
['en_US', 'USD', ' 9999', ['display' => Currency::NO_SYMBOL], '9,999.00'],
229229
['en_US', 'USD', '9999', ['precision' => 1], '$9,999.0'],
230-
['en_US', 'USD', '9999', ['precision' => 2, 'symbol' => '#'], '#9,999.00'],
230+
['en_US', 'USD', '9999', ['precision' => 2, 'symbol' => '#'], '# 9,999.00'],
231231
[
232232
'en_US',
233233
'USD',
234234
'9999.99',
235235
['precision' => 2, 'symbol' => '#', 'display' => Currency::NO_SYMBOL],
236236
'9,999.99'
237237
],
238-
[
239-
'en_US',
240-
'IDR',
241-
'9999',
242-
['display' => Currency::USE_SYMBOL, 'precision' => 2, 'symbol' => 'IDRx NBSP'],
243-
'IDRxNBSP 9,999.00'
244-
],
245238
];
246239
}
247240

0 commit comments

Comments
 (0)