Re: [gtkmm] Button with icon?



Paul Davis <paul linuxaudiosystems com> writes:

[...]

> the _() macro is part of the gettext internationalization system. its
> not just an include. you need to setup gettext for your application.

In case you are wondering how, here's what I do, mostly grabbed
somewhere else from. I have an i18n.hpp header:

  #ifndef GETTEXT_PACKAGE
  #error "config.h must be included prior to i18n.hpp"
  #endif

  #include <libintl.h>
  #include <locale.h>

  #ifdef _
  #undef _
  #endif

  #ifdef N_
  #undef N_
  #endif

  #define _(x) gettext (x)
  #define N_(x) x

In main() you then need something like:

  #include <config.h>
  #include <libintl.h>

  // ...
  int main(int argc, char *argv[])
  {
    // ...

    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
    textdomain(GETTEXT_PACKAGE);

    // ...
  }

If you want to allow your users to configure the location for the i18n
files, you also need to use bindtextdomain(package_name, directory).

-- 
Ole Laursen
http://www.cs.auc.dk/~olau/



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