Settings

Theme

CSS text-transform is language-dependant: the Dutch case explained

firefoxnightly.tumblr.com

37 points by lillycat 14 years ago · 18 comments

Reader

dasil003 14 years ago

I might be biased because I recently spent a couple days wrestling with it, but I think the Turkish case is more interesting. There are two vowels that use the letter I forms:

İ/i and I/ı

So the lowercase and uppercase are essentially split into two letters and then a new uppercase and lowercase form is created based on growing or shrinking the originals. I'm sure it seemed quite the elegant solution in the 1920s when they were working on the latinized Turkish alphabet.

The implication of this is that unlike the Dutch case, this affects all text-transform actions (uppercase, lowercase, and capitalize).

When we were doing our Turkish localized site I started digging into this, and I was horrified that no browser actually supports proper Turkish capitalization rules. Firefox in particular had a bug open since 2004 (now finally fixed as well). Asking around with Turkish web developers I heard of some crazy hacks (custom fonts!), but I got the feeling that Turkish web designers just avoid text-transform. This was not an option for us as we rely heavily on text-transform in our design (http://tr.mubi.com).

In the end I was able to piece together a surprisingly robust javascript replacement method with some help from Stack Overflow:

http://stackoverflow.com/a/8743095/8376

  • lillycatOP 14 years ago

    The Turkic bug was fixed a week ago and we'll also be in Firefox 14. As far as I know Webkit still has this bug. I don't know about IE or Opera, if somebody knows...

pennig 14 years ago

The code path for that case must be delightful.

  • robin_reala 14 years ago
    • masklinn 14 years ago

      It's really weird that they just add special cases like that. Though I expect it's just because they don't have enough special cases yet (went from one — for the Turkish I — to two).

      I'd have expected something like a generic Unicode-aware/y text management layer, and CSS text transforms would just go through that layer.

      • mcpherrinm 14 years ago

        The problem is that Unicode doesn't know about language. Unicode is just characters.

        Language-aware bits are more gross, but then language often is. It's not nicely structured like most of the other things we encounter when transforming data.

      • underwater 14 years ago

        Eek. Not only are they hardcoding the logic but they mix their CSS-specific code into the function. I understand that they are handling a limited number of cases now but if I came across that kind of code in my work I'd be very sceptical.

        • ars 14 years ago

          That's called not over engineering something.

          Making something more complicated doesn't make it better. Make it more complicated when you need to, not before.

      • darklajid 14 years ago

        I wonder how the German ß is handled. Having no clue about the implementation of these transforms, wouldn't that be a similar case?

        • lillycatOP 14 years ago

          Yes, in Firefox the 'esszet' is transformed in SS when in capital letters. But this done since a long time. The dotted and dot-less Turkic, and the Dutch IJ, are new in Firefox 14 (which is the first browser to support it, AFAIK).

          There is some specific cases with accented Greek diphthongs, where the diacritic position changes in upper and lower case, but Mozilla is working on a fix.

Michiel 14 years ago

Of course, editors should be using the ligature (unicode character LATIN SMALL LIGATURE IJ). But having said that: I'm Dutch and a) I have never used that character and b) I have no idea how to write it on a keyboard.

Navarr 14 years ago

Now we only need "text-transform: katakana" and "text-transform: hiragana" for emphasizing Japanese text.

Of course, this can't possibly work with Kanji without some special hack around.

iamgilesbowkett 14 years ago

there is no such word as "dependant." it's "dependent." really sorry to be that guy but it would hugely brighten my day if you could fix the spelling in the title.

  • dbuxton 14 years ago

    Well, there is such a word, certainly in the UK.

    A more constructive comment might be, "the spelling variant you have used is normally a noun meaning 'a person who depends on another for their upkeep or care', where here you want the more normal adjectival spelling 'dependent'."

    Although fwiw it seems that even as an adjective "dependant" might fly: http://www.wordnik.com/words/dependant

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection