enabled i18n support

This commit is contained in:
Bart Hakvoort 2004-09-20 15:46:21 +00:00
parent b5c6ef40d7
commit cf33622e8a
10 changed files with 58 additions and 20 deletions

View File

@ -1 +1 @@
SUBDIRS = include src
SUBDIRS = include src po

View File

@ -1 +1 @@
AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])

View File

@ -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
])

View File

@ -23,16 +23,14 @@
#ifndef DIALOG_ABOUT
#define DIALOG_ABOUT
#include "../include/i18n.h"
#include <gtkmm/dialog.h>
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <gtkmm/stock.h>
#include <gtkmm/notebook.h>
//i18n stuff ....
#include <libintl.h>
#define _(String) gettext(String)
class Dialog_About : public Gtk::Dialog
{
public:

View File

@ -18,6 +18,8 @@
#ifndef DIALOG_PARTITION_PROGRESS
#define DIALOG_PARTITION_PROGRESS
#include "../include/i18n.h"
#include <gtkmm/dialog.h>
#include <gtkmm/progressbar.h>
#include <gtkmm/stock.h>
@ -25,10 +27,6 @@
#include <sstream>
//i18n stuff ....
#include <libintl.h>
#define _(String) gettext(String)
class Dialog_Progress : public Gtk::Dialog
{
public:

View File

@ -20,14 +20,11 @@
#include "../include/Partition.h"
#include "../include/Device.h"
#include "../include/i18n.h"
#include <gtkmm/messagedialog.h>
#include <glibmm/ustring.h>
//i18n stuff ....
#include <libintl.h>
#define _(String) gettext(String)
namespace GParted
{

View File

@ -22,16 +22,14 @@
#ifndef PARTITION
#define PARTITION
#include "../include/i18n.h"
#include <glibmm/ustring.h>
#include <gdkmm/colormap.h>
#include <sstream>
#include <iostream>
//i18n stuff ....
#include <libintl.h>
#define _(String) gettext(String)
#define MEGABYTE 2048 //try it: 2048 * 512 / 1024 /1024 == 1 :P
namespace GParted

27
include/i18n.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef I18N
#define I18N
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#ifdef ENABLE_NLS
#include <libintl.h>
#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 */

View File

@ -1,5 +1,6 @@
INCLUDES =\
$(GTKMM_CFLAGS)
$(GTKMM_CFLAGS) \
-DGPARTEDLOCALEDIR=\""$(gpartedlocaledir)"\"
AM_CFLAGS =\
-Wall\

View File

@ -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 )
{