←back to thread

71 points zobweyt | 4 comments | | HN request time: 0.87s | source
Show context
frizlab ◴[] No.43553870[source]
Great library!

Does it support non-English title casing?

For instance in French, title casing for “les maisons bleues” is “Les Maisons bleues” while for “des maisons bleues” it’s “Des maisons bleues”.

replies(1): >>43553910 #
zobweyt ◴[] No.43553910[source]
Thanks!

It does not support non-English title casing. From the documentation:

> It also works non-ascii characters. However, no inferences on the language itself is made. For instance, the digraph ij in Dutch will not be capitalized, because it is represented as two distinct Unicode characters. However, æ would be capitalized

replies(3): >>43554503 #>>43554857 #>>43555116 #
1. zvr ◴[] No.43554503[source]
Nice work, but since it does not handle anything else than strings, maybe it should be named "stringcase" or something.
replies(1): >>43554547 #
2. zobweyt ◴[] No.43554547[source]
Thank you for the feedback!

I appreciate your suggestion regarding the name, but unfortunately this name was already taken, so "textcase" was chosen.

I also have ideas for adding dictionary key conversion and other features in the future that will handle more than just strings. In addition, you can use this library to convert cases of Iterable[str] using textcase.pattern

replies(1): >>43555576 #
3. zvr ◴[] No.43555576[source]
My issue with using "text" is that I assume that a text like "I THINK I DO" should be converted to "I think I do", not "i think i do".

And that's just in English...

If "text" is in Greek, like "Καλημέρα", the upper form should be "ΚΑΛΗΜΕΡΑ", not a juxtaposition of upper() conversions of each letter.

replies(1): >>43555617 #
4. zobweyt ◴[] No.43555617{3}[source]
Thanks for the clarification!

Yeah, there is such a problem with the naming "text" suggests something different than just a "string".

I guess handling these nuances falls under the broader categories of internationalization (i18n) and localization (l10n).