Skip to content

[String] New locale aware casing methods #52198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2023

Conversation

bram123
Copy link
Contributor

@bram123 bram123 commented Oct 20, 2023

Q A
Branch? 7.1
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #52161
License MIT

Adds new localeUpper/localeLower/localeTitle methods to the AbstractUnicodeString class

  • To change the string case according to locale-specific case mappings

Code examples:

$string = new UnicodeString('άδικος');
echo $string->upper(), PHP_EOL; // ΆΔΙΚΟΣ
echo $string->localeUpper('el'), PHP_EOL; // ΑΔΙΚΟΣ

$string = new UnicodeString('ijssel');
echo $string->title(), PHP_EOL; // Ijssel
echo $string->localeTitle('nl'), PHP_EOL; // IJssel

$string = new UnicodeString('İSTANBUL');
echo $string->lower(), PHP_EOL; // i̇stanbul (LATIN SMALL LETTER I COMBINING DOT ABOVE)
echo $string->localeLower('tr'), PHP_EOL; // istanbul (LATIN SMALL LETTER I)

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also add a line to the changelog of the component?

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor nitpicking and GTM, thanks.

@smnandre
Copy link
Member

Re-copying this there in case we need it in a following PR or to write doc :

--> official ICU list of special casings

@bram123 bram123 requested a review from derrabus October 23, 2023 10:01
@nicolas-grekas nicolas-grekas modified the milestones: 6.4, 7.1 Oct 23, 2023
@fabpot fabpot force-pushed the locale_string_formatter branch from 0263036 to 7f4ed5c Compare November 18, 2023 18:32
@fabpot
Copy link
Member

fabpot commented Nov 18, 2023

Thank you @bram123.

@fabpot fabpot merged commit 19f5240 into symfony:7.1 Nov 18, 2023
@fabpot fabpot mentioned this pull request May 2, 2024
@bram123 bram123 deleted the locale_string_formatter branch October 3, 2024 17:41
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.

[String] New LocaleString class
8 participants