str.title() fails with words containing apostrophes

Marko Rauhamaa marko at pacujo.net
Mon Mar 6 09:03:07 EST 2017


Chris Angelico <rosuav at gmail.com>:

> Right. If you want true title casing, it has to be *extremely*
> linguistically-aware.

For instance, title case has no meaning in the context of Finnish. In
other words, your internationalized program shouldn't even think of
title case when localized in Finnish.

This localization problem runs even deeper. My Windows Phone displays
the time and date:

    15:49
    maanantai
    6. maaliskuuta

It gets many things right. However, in Finland, nobody ever spells out
the month name in dates. "March 6" should be localized to "6.3.",
preferably to "6.3.2017".

> Still, it's fun to discuss, if only to show why that kind of
> locale-aware transformation is important.

Finland is a bilingual country. You often see street ads for the same
product in Finnish and Swedish. What is notable is that the Finnish and
Swedish variants can have completely different punchlines because a
translation just wouldn't sound good either way.


Marko



More information about the Python-list mailing list