diff --git a/Makefile.am b/Makefile.am index c74acb44..c055a364 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1 +1 @@ -SUBDIRS = include src +SUBDIRS = include src po diff --git a/acinclude.m4 b/acinclude.m4 index 7e553f36..8b137891 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1 +1 @@ -AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) + diff --git a/configure.in b/configure.in index 05df0c3e..d12f2493 100644 --- a/configure.in +++ b/configure.in @@ -3,6 +3,8 @@ AM_INIT_AUTOMAKE(gparted, 0.1) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE +AC_PROG_INTLTOOL + AC_ISC_POSIX AC_PROG_CC AC_PROG_CXX @@ -19,10 +21,21 @@ AC_SUBST(GTKMM_CFLAGS) dnl Set PACKAGE SOURCE DIR in config.h. packagesrcdir=`cd $srcdir && pwd` +dnl i18n stuff ... +GETTEXT_PACKAGE=gparted +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",[description]) + +ALL_LINGUAS="" +AM_GLIB_GNU_GETTEXT + +gpartedlocaledir='${prefix}/${DATADIRNAME}/locale' +AC_SUBST(gpartedlocaledir) AC_OUTPUT([ Makefile include/Makefile src/Makefile +po/Makefile.in ]) diff --git a/include/Dialog_About.h b/include/Dialog_About.h index 31b6854c..4553231f 100644 --- a/include/Dialog_About.h +++ b/include/Dialog_About.h @@ -23,16 +23,14 @@ #ifndef DIALOG_ABOUT #define DIALOG_ABOUT +#include "../include/i18n.h" + #include #include #include #include #include -//i18n stuff .... -#include -#define _(String) gettext(String) - class Dialog_About : public Gtk::Dialog { public: diff --git a/include/Dialog_Progress.h b/include/Dialog_Progress.h index 641011e0..cfc1364f 100644 --- a/include/Dialog_Progress.h +++ b/include/Dialog_Progress.h @@ -18,6 +18,8 @@ #ifndef DIALOG_PARTITION_PROGRESS #define DIALOG_PARTITION_PROGRESS +#include "../include/i18n.h" + #include #include #include @@ -25,10 +27,6 @@ #include -//i18n stuff .... -#include -#define _(String) gettext(String) - class Dialog_Progress : public Gtk::Dialog { public: diff --git a/include/Operation.h b/include/Operation.h index a84f531f..e67f7903 100644 --- a/include/Operation.h +++ b/include/Operation.h @@ -20,14 +20,11 @@ #include "../include/Partition.h" #include "../include/Device.h" +#include "../include/i18n.h" #include #include -//i18n stuff .... -#include -#define _(String) gettext(String) - namespace GParted { diff --git a/include/Partition.h b/include/Partition.h index ce55a0f6..8ec7dcca 100644 --- a/include/Partition.h +++ b/include/Partition.h @@ -22,16 +22,14 @@ #ifndef PARTITION #define PARTITION +#include "../include/i18n.h" + #include #include #include #include -//i18n stuff .... -#include -#define _(String) gettext(String) - #define MEGABYTE 2048 //try it: 2048 * 512 / 1024 /1024 == 1 :P namespace GParted diff --git a/include/i18n.h b/include/i18n.h new file mode 100644 index 00000000..83455fa5 --- /dev/null +++ b/include/i18n.h @@ -0,0 +1,27 @@ +#ifndef I18N +#define I18N + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ + +#ifdef ENABLE_NLS +#include +#define _(String) gettext(String) +#ifdef gettext_noop +#define N_(String) gettext_noop(String) +#else +#define N_(String) (String) +#endif +#else /* NLS is disabled */ +#define _(String) (String) +#define N_(String) (String) +#define textdomain(String) (String) +#define gettext(String) (String) +#define dgettext(Domain,String) (String) +#define dcgettext(Domain,String,Type) (String) +#define bindtextdomain(Domain,Directory) (Domain) +#define bind_textdomain_codeset(Domain,Codeset) (Codeset) +#endif /* ENABLE_NLS */ + +#endif /* I18N */ diff --git a/src/Makefile.am b/src/Makefile.am index 432c73cb..98982dc0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,6 @@ INCLUDES =\ - $(GTKMM_CFLAGS) + $(GTKMM_CFLAGS) \ + -DGPARTEDLOCALEDIR=\""$(gpartedlocaledir)"\" AM_CFLAGS =\ -Wall\ diff --git a/src/main.cc b/src/main.cc index bc0abcf7..0b2bd62a 100644 --- a/src/main.cc +++ b/src/main.cc @@ -23,7 +23,13 @@ int main( int argc, char *argv[] ) Glib::thread_init(); Gtk::Main kit(argc, argv); - + + //i18n + setlocale (LC_ALL, ""); + bindtextdomain (GETTEXT_PACKAGE, GPARTEDLOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + //check UID if ( getuid() != 0 ) {