[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Adding two-parameter form of I18N_NOOP?
From:       Marc Mutz <Marc.Mutz () uni-bielefeld ! de>
Date:       2001-11-26 12:09:42
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

I came across the following problem: I need a I18N_NOOP in the 
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 
admin/Makefile.common?

Here's why I need it (or think I need it - feel free to suggest better 
ways):
While cleaning up KMail's configuredialog, I could often replace 
sequences like this one:
  mNestingPolicy =
    new QVButtonGroup( i18n("Message header threading options"), this );
    mNestingPolicy->insert(
    new QRadioButton( i18n("&Always keep threads open"),
		      mNestingPolicy ), 0 );
  mNestingPolicy->insert(
    new QRadioButton( i18n("Threads default to &open"),
		      mNestingPolicy ), 1 );
  mNestingPolicy->insert(
    new QRadioButton( i18n("Threads default to &closed"),
		      mNestingPolicy ), 2 );
  mNestingPolicy->insert(
    new QRadioButton( i18n("Open threads that contain new or "
			   "&unread messages"), mNestingPolicy ), 3 );

with something like:
  mNestingPolicy =
    new QVButtonGroup( i18n("Message header threading options"), this );  
  for ( int i = 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[] = {
  { "foo", I18N_NOOP("&Always keep threads open") },
  // ...
};
static const int numNestingOptions =
   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 
are certainly examples that require it).

I currently moved the initialization of this stuff into the c'tor of the 
class and used i18n.

Marc

- -- 
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=
=p3RQ
-----END PGP SIGNATURE-----

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic