# [DISCUSSION] ext/intl: single-value skeleton formatter (GH-24165)

- Thread: https://externals.io/message/132820
- Original archive: https://news-web.php.net/php.internals/132820
- Started by David CARLIER on 2026-10-06T18:39:59+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #132820 — David CARLIER — 2026-10-06T18:39:59+00:00

URL: https://externals.io/message/132820#132820

Hi,

GH-24165 asks for unit formatting in intl (e.g. "5 km/h", "5 kilometers per
hour"). NumberFormatter can't do it as it sits on the legacy ICU API, and
switching it to icu::number would break patterns, attributes and RBNF
styles.

Since 8.6 it is doable with IntlNumberRangeFormatter by passing the same
value twice, but that's a hack.

I would like to add a single-value counterpart, IntlNumberFormatter, built
from a skeleton:

echo IntlNumberFormatter::createFromSkeleton(
    'measure-unit/speed-kilometer-per-hour unit-width-full-name',
'fr')->format(5);

It would cover units and the rest of what skeletons support, and it would
only be available with a recent enough ICU.

Cheers.

---

## #132833 — tim@bastelstu.be — 2026-10-08T13:16:27+00:00

URL: https://externals.io/message/132820#132833 · In reply to: #132820

Hi


> I would like to add a single-value counterpart, IntlNumberFormatter, 
> built
> from a skeleton:
> 
> echo IntlNumberFormatter::createFromSkeleton(
>     'measure-unit/speed-kilometer-per-hour unit-width-full-name',
> 'fr')->format(5);
> 
> It would cover units and the rest of what skeletons support, and it 
> would
> only be available with a recent enough ICU.

It's unfortunate that we would then have both `NumberFormatter` and 
`IntlNumberFormatter`, but getting something on the non-legacy API and 
with a proper `Intl` prefix would be a good thing. I'm thus in favor. As 
future scope we should probably deprecate `NumberFormatter` then.

Best regards
Tim Düsterhus
