Localization Bugs: Clipped text, #4
I've shown how a resource that looks fine to me can still be clipped at runtime, if for instance the font or font attributes change.
I don't actually see this happening all that often, save for in Wizards. It's far more common that the text of a label is set or changed while the code is running. Today I'll talk about when a label is given some statically defined text at runtime.
Let me show an example - here's sndvol32.exe as I see it in my favourite localization tool:
It might look a little bit messy with the images in there, but that'll be ok at runtime. At least there's no text clipping. Except, of course, at runtime:
A sharp eye will notice that the volume control application dynamically adds this single dialog once for each input on the sound card. Since sndvol can't know beforehand what those inputs might be, it fetches the display value from the sound card driver. Some of these are noticeably longer than the static text, "Linje", and so we have a clipping.
This type of thing is pretty common. A dialog has a label, the text for this label is completely static (so we could know the exact width of it), but we don't know which string might be used in the label. Sometimes all strings possible are within the same binary as the dialog, sometimes the resources come from other files. In this case, I have absolutely no control over what those strings might be.
The solution? Well, now that I know about the issue, I'd probably make the dialog and label as wide as I can without making it look ugly. Besides that, I've got to remember to test the applet at run time. For some other similar clippings - where we can build up a mapping of which string might be used in which label - it'd be possible to build a check that reports if any of those strings won't fit. The hard part, as always, is to build and maintain such a mapping.
Btw, bonus points for noticing the duplicate hotkey. Triple-extra-bonus points for figuring out how I can fix it.
This posting is provided "AS IS" with no warranties, and confers no rights.
Comments
- Anonymous
December 07, 2004
The comment has been removed