From kde-core-devel Mon Nov 26 12:09:42 2001 From: Marc Mutz Date: Mon, 26 Nov 2001 12:09:42 +0000 To: kde-core-devel Subject: Adding two-parameter form of I18N_NOOP? X-MARC-Message: https://marc.info/?l=kde-core-devel&m=100677658232708 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi! I came across the following problem: I need a I18N_NOOP in the=20 two-parameter form. Is it as easy as adding #ifndef I18N_NOOP2 #define I18N_NOOP2(x,y) (y) #endif to klocale.h and adding -kI18N_NOOP2 to the xgettext command line in=20 admin/Makefile.common? Here's why I need it (or think I need it - feel free to suggest better=20 ways): While cleaning up KMail's configuredialog, I could often replace=20 sequences like this one: mNestingPolicy =3D new QVButtonGroup( i18n("Message header threading options"), this ); mNestingPolicy->insert( new QRadioButton( i18n("&Always keep threads open"), =09=09 mNestingPolicy ), 0 ); mNestingPolicy->insert( new QRadioButton( i18n("Threads default to &open"), =09=09 mNestingPolicy ), 1 ); mNestingPolicy->insert( new QRadioButton( i18n("Threads default to &closed"), =09=09 mNestingPolicy ), 2 ); mNestingPolicy->insert( new QRadioButton( i18n("Open threads that contain new or " =09=09=09 "&unread messages"), mNestingPolicy ), 3 ); with something like: mNestingPolicy =3D new QVButtonGroup( i18n("Message header threading options"), this ); = =20 for ( int i =3D 0 ; i < numNestingOptions ; i++ ) mNestingPolicy->insert( new QRadioButton( i18n( nestingOptions[i].displayName ), mNestingPolicy ), i ); where nestingOptions is a compile-time constant, defined in the class: //... static const struct { const char * const configName; const char * const displayName; } nestingOptions[] =3D { { "foo", I18N_NOOP("&Always keep threads open") }, // ... }; static const int numNestingOptions =3D sizeof nestingOptions / sizeof *nestingOptions; //... This works well until I try to hint the strings with e.g. "threading option" (this example doesn't really need hinting, but there=20 are certainly examples that require it). I currently moved the initialization of this stuff into the c'tor of the=20 class and used i18n. Marc - --=20 We have once again come full circle on the same basic question of privacy on the Internet. If you have privacy, so does the person sending around terrorist documents. And of course, we wouldn't want that now, would we? [...] But what if governments, concerned about mounting public pressure, decided to label protesters at the next WTO roundtable, World Bank meeting, or G-8 summit as terrorists? -- John Horvath: The Internet: A Terrorist Network? Telepolis 2001/08/22 (#9350) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8Ak143oWD+L2/6DgRAtRAAKDq6khHeai1TzA4M7xIVPBH6n8pGQCg+6ed 0Nr5CBDI4A9sYGgqVPx2H+U=3D =3Dp3RQ -----END PGP SIGNATURE-----