[passepartout] added a function to initialize i18n
- From: Sven Herzberg <herzi src gnome org>
- To: svn-commits-list gnome org
- Subject: [passepartout] added a function to initialize i18n
- Date: Tue, 28 Apr 2009 05:56:45 -0400 (EDT)
commit 8218979874cca6916a5469163070ae6833f60cea
Author: Sven Herzberg <herzi lanedo com>
Date: Tue Apr 28 09:55:46 2009 +0200
added a function to initialize i18n
* src/pptout/Makefile.am: added the new sources
* src/pptout/i18n.cc,
* src/pptout/i18n.h: added the i18n initialization
* src/pptout/main.cc: use the new function to initialize i18n
---
src/pptout/Makefile.am | 2 +
src/pptout/i18n.cc | 59 ++++++++++++++++++++++++++++++++++++++++++++++++
src/pptout/i18n.h | 34 +++++++++++++++++++++++++++
src/pptout/main.cc | 10 ++-----
4 files changed, 98 insertions(+), 7 deletions(-)
diff --git a/src/pptout/Makefile.am b/src/pptout/Makefile.am
index 7bdb737..e665595 100644
--- a/src/pptout/Makefile.am
+++ b/src/pptout/Makefile.am
@@ -8,6 +8,7 @@ dist_noinst_HEADERS=\
aboutdialog.h \
authors.h \
config.h \
+ i18n.h \
icons.h \
preferencesdialog.h \
docpropsdialog.h docview.h groupmeta.h imagemeta.h \
@@ -24,6 +25,7 @@ BUILT_SOURCES=\
$(NULL)
passepartout_SOURCES=\
+ i18n.cc \
icons.c \
inspiration.cc streamdialog.cc pagesel.cc \
aboutdialog.cc docmeta.cc printdialog.cc viewent.cc \
diff --git a/src/pptout/i18n.cc b/src/pptout/i18n.cc
new file mode 100644
index 0000000..3149ee0
--- /dev/null
+++ b/src/pptout/i18n.cc
@@ -0,0 +1,59 @@
+/* This file is part of passepartout
+ *
+ * AUTHORS
+ * Sven Herzberg
+ *
+ * Copyright (C) 2009 Sven Herzberg
+ *
+ * This work is provided "as is"; redistribution and modification
+ * in whole or in part, in any medium, physical or electronic is
+ * permitted without restriction.
+ *
+ * This work is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * In no event shall the authors or contributors be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential
+ * damages (including, but not limited to, procurement of substitute
+ * goods or services; loss of use, data, or profits; or business
+ * interruption) however caused and on any theory of liability, whether
+ * in contract, strict liability, or tort (including negligence or
+ * otherwise) arising in any way out of the use of this software, even
+ * if advised of the possibility of such damage.
+ */
+
+#include "i18n.h"
+
+#include "defines.h"
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+namespace Passepartout
+{
+
+bool
+init_i18n (void)
+{
+ static bool initialized = false;
+
+ if (G_UNLIKELY (!initialized))
+ {
+#ifdef ENABLE_NLS
+ /* initialize i18n */
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+#endif
+
+ gtk_set_locale ();
+
+ initialized = true;
+ }
+
+ return true;
+}
+
+}
+
diff --git a/src/pptout/i18n.h b/src/pptout/i18n.h
new file mode 100644
index 0000000..8ec0b53
--- /dev/null
+++ b/src/pptout/i18n.h
@@ -0,0 +1,34 @@
+/* This file is part of passepartout
+ *
+ * AUTHORS
+ * Sven Herzberg
+ *
+ * Copyright (C) 2009 Sven Herzberg
+ *
+ * This work is provided "as is"; redistribution and modification
+ * in whole or in part, in any medium, physical or electronic is
+ * permitted without restriction.
+ *
+ * This work is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * In no event shall the authors or contributors be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential
+ * damages (including, but not limited to, procurement of substitute
+ * goods or services; loss of use, data, or profits; or business
+ * interruption) however caused and on any theory of liability, whether
+ * in contract, strict liability, or tort (including negligence or
+ * otherwise) arising in any way out of the use of this software, even
+ * if advised of the possibility of such damage.
+ */
+
+#ifndef I18N_H
+#define I18N_H
+
+namespace Passepartout
+{
+ bool init_i18n (void);
+}
+
+#endif /* !I18N_H */
diff --git a/src/pptout/main.cc b/src/pptout/main.cc
index 8c72da4..8e8fd77 100644
--- a/src/pptout/main.cc
+++ b/src/pptout/main.cc
@@ -14,8 +14,9 @@
#include <libgnomevfs/gnome-vfs.h>
#endif
-#include "window.h"
+#include "i18n.h"
#include "config.h"
+#include "window.h"
#include "icons/icon_48.h"
#include "stockitems.h"
@@ -29,12 +30,7 @@ int main(int argc, char *argv[]) {
// set prefix for temp files
Tempfile::set_prefix("pptout");
-#ifdef ENABLE_NLS
- /* initialize i18n */
- bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-#endif
+ Passepartout::init_i18n ();
// initialize threads
Glib::thread_init();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]