Re: [DISCUSSION] Add locale and strength for grapheme functions
| From: | Derick Rethans | Date: | Mon, 14 Jul 2025 10:22:52 +0000 |
| Subject: | Re: [DISCUSSION] Add locale and strength for grapheme functions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-128028@lists.php.net to get a copy of this message | ||
On Wed, 9 Jul 2025, youkidearitai wrote:
> Hi, Internals
>
> I changed below the RFC.
> -
> https://wiki.php.net/rfc/grapheme_add_locale_for_case_insensitive
> Pull request is below:
> - https://github.com/php/php-src/pull/18792
>
> Change point is below:
> - Add a strength for grapheme_* functions
> - Affect to all over the world characters, ex: Ideographic Variation
> Sequence(IVS)
> - Use Collator object const values.
These settings are indeed important for these functions, but I can't get
around the fact that it makes these APIs really cluttered and
complicated — something that many functions in the grapheme_ / intl
extension already suffer from.
Is this API really the best way?
> $locale parameter is not change anything. Because I could not find any way.
It seems that I came to a similar conclusion, but locales are much more
complicated than just languageCode_regionCode (for example, see
https://github.com/derickr/php-text/blob/main/tests/text-contains.phpt#L25)
You also don't really need a strength argument, as you can 'encode' that
in the locale name, like: 'nb_NO-u-ks-primary' (I know, it's rather ugly
and the list of options is vast:
https://www.unicode.org/reports/tr35/tr35-collation.html#Common_Settings
cheers,
Derick