Skip to content

ext/intl: Migrate formatter, listformatter, and rangeformatter from I…#21378

Open
devnexen wants to merge 2 commits intophp:masterfrom
devnexen:intl_to_cxx_internals_1
Open

ext/intl: Migrate formatter, listformatter, and rangeformatter from I…#21378
devnexen wants to merge 2 commits intophp:masterfrom
devnexen:intl_to_cxx_internals_1

Conversation

@devnexen
Copy link
Member

@devnexen devnexen commented Mar 7, 2026

…CU C API to C++ API.

  • formatter: Replace intl_convert_utf8_to_utf16/uloc_getISO3Language with intl_stringFromChar/icu::Locale, use UnicodeString for pattern handling
  • listformatter: Replace ulistfmt_open/ulistfmt_openForType/ulistfmt_close/ ulistfmt_format with ListFormatter C++ equivalents, use UnicodeString array and intl_stringFromChar/intl_charFromString for string conversions
  • rangeformatter: Replace uloc_getISO3Language with icu::Locale::getISO3Language

…CU C API to C++ API.

- formatter: Replace intl_convert_utf8_to_utf16/uloc_getISO3Language with
  intl_stringFromChar/icu::Locale, use UnicodeString for pattern handling
- listformatter: Replace ulistfmt_open/ulistfmt_openForType/ulistfmt_close/
  ulistfmt_format with ListFormatter C++ equivalents, use UnicodeString array
  and intl_stringFromChar/intl_charFromString for string conversions
- rangeformatter: Replace uloc_getISO3Language with icu::Locale::getISO3Language
Replace UNumberFormat*/unum_* with icu::NumberFormat C++ equivalents.
Attribute get/set still use reinterpret_cast<UNumberFormat*> for now.

Note: formatter_fail.phpt expectation updated because
NumberFormat::createInstance() returns U_ILLEGAL_ARGUMENT_ERROR for
out-of-range styles (style < 0), whereas unum_open() returned
U_UNSUPPORTED_ERROR via its default switch case.
@devnexen devnexen force-pushed the intl_to_cxx_internals_1 branch from d812f7c to e6e5a66 Compare March 7, 2026 20:10
@devnexen devnexen marked this pull request as ready for review March 7, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant