[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unicode quotes in C



It'd be nice to be able to output strings with correct open- and
close-quotes.  It's a bit tricky; many programs need to operate
without gettext when it's not available, so the quotes can't be
put in source directly (ignoring UTF8-in-source issues.)

I've thrown together a small script to generate en.po from a
default.pot, changing ` and ' to ‘ and ’, and " to “ and ”,
attempting to leave apostrophes alone.  It's fairly (embarassingly)
ugly; my Perl is rusty.  I'm sure it doesn't parse all potfiles
cleanly, and it definitely doesn't handle all uses of ' correctly;
but it's a start, and it seems to handle everything in lftp (the only
program I've tried it with.)

A downside is needing to edit Makefile.in.in to call this; many
programs already have to edit it for various reasons anyway, however.
An option to not use these translations (for programs using it
specifically) would be useful, as a lot of terminals support UTF-8
but don't handle those particular characters correctly yet.  (Even
PuTTY--Windows SSH terminal--has this problem with MS Mincho, though
Lucida Console works fine.)

It might be useful to also translate `` and '' to “ and ”.

Suggestions or alternatives?

-- 
Glenn Maynard

Attachment: trans_quotes.pl
Description: Perl program