Skip to content
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

The String Capitalize Function Doesn't Handle Apostrophes Correctly Resulting In Bad Output #90192

Closed
timkrief opened this issue Apr 4, 2024 · 3 comments

Comments

@timkrief
Copy link

timkrief commented Apr 4, 2024

Tested versions

Tested in 3.5.2 and 4.2.stable

System information

Latest Ubuntu LTS

Issue description

In French, if I want to capitalize "le feu" it will output "Le Feu" correctly. But if the word starts with a vowel, the "le" is shortened as "l'", and in that case "l'eau" capitalized should output "L'Eau" but it outputs "L'eau".

Steps to reproduce

You can just run this line to see the issue:
print("L'eau ça mouille".capitalize())

Results in:
L'eau Ça Mouille

Minimal reproduction project (MRP)

extends Node

func _ready():
	print("L'eau ça mouille".capitalize())
@bruvzg
Copy link
Member

bruvzg commented Apr 4, 2024

String.capitalize only handle spaces and _.

capitalized should output "L'Eau" but it outputs "L'eau"

Every app I have tried do exactly the same thing.

For 4.x, it should be possible to expose a language specific variant for this function from ICU used in the TextServer, but in this case it's also doing exactly the same.

@ajreckof
Copy link
Member

ajreckof commented Apr 4, 2024

I wouldn't expect a word after an apostrophes to be capitalised and that independent of the language.
On the note of apostrophes and french would you also expect "aujourd'hui" to be capitalised as "Aujourd'Hui"?

@timkrief
Copy link
Author

timkrief commented Apr 4, 2024

"Aujourd'hui" would be an exception, which makes me think that I think it's better to keep this function as is and create custom or langage specific capitalize functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants