commerceguys / intl

A PHP internationalization library, powered by CLDR data.
MIT License
361 stars 45 forks source link

How set empty grouping_separator #78

Closed batkor closed 4 years ago

batkor commented 4 years ago

Hi guys! How set empty grouping_separator ?

If override number format and set empty grouping_separator in Drupal 8

/**
   * Correct price format
   *
   * @param \Drupal\commerce_price\Event\NumberFormatDefinitionEvent $event
   */
  public function priceFormat(NumberFormatDefinitionEvent $event) {
    $def = $event->getDefinition();
    $def['grouping_separator'] = '';
    $def['currency_pattern'] = '#,##0.00 ¤';
    $event->setDefinition($def);
  }

After change grouping_separator,Function strtr returns FALSE in parseNumber trait

How set empty grouping separator?

Thanks

batkor commented 4 years ago

I changed currency pattern

  /**
   * Correct price format
   *
   * @param \Drupal\commerce_price\Event\NumberFormatDefinitionEvent $event
   */
  public function priceFormat(NumberFormatDefinitionEvent $event) {
    $def = $event->getDefinition();
    $def['currency_pattern'] = '#0.00 ¤';
    $event->setDefinition($def);
  }

Forked for me :-)