]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
New example 'hello-c++-gnome3'.
authorBruno Haible <bruno@clisp.org>
Wed, 18 Dec 2024 18:04:47 +0000 (19:04 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 18 Dec 2024 18:31:54 +0000 (19:31 +0100)
* gettext-tools/examples/hello-c++-gnome3: New directory, based on
gettext-tools/examples/hello-c-gnome3.
* gettext-tools/examples/Makefile.am (EXAMPLESFILES, EXAMPLESDIRS): Update.
* gettext-tools/examples/po/Makefile.am (POTFILES, SMALLPOTS,
SMALLPOFILES_FOR_lang): Update.
* gettext-tools/examples/README: Update.
* gettext-tools/examples/check-examples: Handle this directory as well.
* NEWS: Mention the new example.
* HACKING: Mention the gtkmm dependency.

20 files changed:
HACKING
NEWS
gettext-tools/examples/Makefile.am
gettext-tools/examples/README
gettext-tools/examples/check-examples
gettext-tools/examples/hello-c++-gnome3/INSTALL [new file with mode: 0644]
gettext-tools/examples/hello-c++-gnome3/Makefile.am [new file with mode: 0644]
gettext-tools/examples/hello-c++-gnome3/README [new file with mode: 0644]
gettext-tools/examples/hello-c++-gnome3/autoclean.sh [new file with mode: 0755]
gettext-tools/examples/hello-c++-gnome3/autogen.sh [new file with mode: 0755]
gettext-tools/examples/hello-c++-gnome3/configure.ac [new file with mode: 0644]
gettext-tools/examples/hello-c++-gnome3/hello.cc [new file with mode: 0644]
gettext-tools/examples/hello-c++-gnome3/hello.desktop.in.in [new file with mode: 0644]
gettext-tools/examples/hello-c++-gnome3/hello.gresource.xml [new file with mode: 0644]
gettext-tools/examples/hello-c++-gnome3/hello.ui [new file with mode: 0644]
gettext-tools/examples/hello-c++-gnome3/m4/Makefile.am [new file with mode: 0644]
gettext-tools/examples/hello-c++-gnome3/po/LINGUAS [new file with mode: 0644]
gettext-tools/examples/hello-c++-gnome3/po/Makevars [new file with mode: 0644]
gettext-tools/examples/hello-c++-gnome3/po/POTFILES.in [new file with mode: 0644]
gettext-tools/examples/po/Makefile.am

diff --git a/HACKING b/HACKING
index 4c602997ab2b559dac51761be797de4cb81c6010..90f4e0138d3191209ae780c173121c8752d52f89 100644 (file)
--- a/HACKING
+++ b/HACKING
@@ -326,6 +326,13 @@ also need to install:
       - On Debian and Debian-based systems: libgtk-3-dev,
       - On Red Hat distributions: gtk3-devel.
       - Other: https://repology.org/project/gtk/versions
+  * Its C++ bindings
+    + Homepage: https://gtkmm.gnome.org/
+      and:      https://www.gtk.org/docs/language-bindings/cpp
+    + Pre-built package name:
+      - On Debian and Debian-based systems: libgtkmm-3.0-dev,
+      - On Red Hat distributions: gtkmm3.0-devel.
+      - Other: https://repology.org/project/gtkmm/versions
 
   * The Qt GUI toolkit library
     + Homepage: https://www.qt.io/
diff --git a/NEWS b/NEWS
index 757665d5547792830db8d513771db85d066e1857..9a6f41dd01e1d4e9c137fc95d7fb0d1c9eebd1ed 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ Version 0.24 - December 2024
   * The contents of the po/ directory has been changed:
     - A file Makefile.in replaces the old Makefile.in.in.
 # Programming languages support:
+  * C++:
+    - A new example 'hello-c++-gnome3' has been added.
   * Ruby:
     - A new example 'hello-ruby' has been added.
 
index d6e4af0b4ed0935143bd1a709a154daa541ec6e7..f5eb42e15eed57371efe22012b590a2d4df062e8 100644 (file)
@@ -155,6 +155,20 @@ EXAMPLESFILES = \
   hello-c++-gnome2/po/Makevars \
   hello-c++-gnome2/po/POTFILES.in \
   \
+  hello-c++-gnome3/INSTALL \
+  hello-c++-gnome3/README \
+  hello-c++-gnome3/autogen.sh \
+  hello-c++-gnome3/autoclean.sh \
+  hello-c++-gnome3/hello.cc \
+  hello-c++-gnome3/hello.desktop.in.in \
+  hello-c++-gnome3/hello.gresource.xml \
+  hello-c++-gnome3/hello.ui \
+  hello-c++-gnome3/Makefile.am \
+  hello-c++-gnome3/configure.ac \
+  hello-c++-gnome3/m4/Makefile.am \
+  hello-c++-gnome3/po/Makevars \
+  hello-c++-gnome3/po/POTFILES.in \
+  \
   hello-c++-wxwidgets/INSTALL \
   hello-c++-wxwidgets/autogen.sh \
   hello-c++-wxwidgets/autoclean.sh \
@@ -405,6 +419,7 @@ EXAMPLESDIRS = \
   hello-c++-qt \
   hello-c++-kde \
   hello-c++-gnome2 \
+  hello-c++-gnome3 \
   hello-c++-wxwidgets \
   hello-objc \
   hello-objc-gnustep \
index a3193bb31ae94d4321cada01e88e099cccb6a2dd..946dbe56b0467cc16d1fdb02d76eabd2fba13a9d 100644 (file)
@@ -13,6 +13,7 @@ environment.
     hello-c++-qt               C++               Qt
     hello-c++-kde              C++               KDE
     hello-c++-gnome2           C++               GNOME 2 (obsolete)
+    hello-c++-gnome3           C++               GNOME 3.10 or later
     hello-c++-wxwidgets        C++               wxWidgets
     hello-objc                 ObjectiveC
     hello-objc-gnustep         ObjectiveC        GNUstep
@@ -62,6 +63,7 @@ Makefile types:
     hello-c++20                .gmo                    Makefile.in
     hello-c++-kde              .gmo                    Makefile.in
     hello-c++-gnome2           .gmo                    Makefile.in
+    hello-c++-gnome3           .gmo                    Makefile.in
     hello-objc                 .gmo                    Makefile.in
     hello-objc-gnome2          .gmo                    Makefile.in
     hello-c++-wxwidgets        .gmo                    Makefile.am
index 55ce06e7b4152e6235e92b289090a274f7af9de5..36551167ffeca1bf3e62747ddd56c182fb6eebc5 100755 (executable)
@@ -136,6 +136,7 @@ func_check_autoclean_all ()
   func_check_autoclean hello-c++-qt
   func_check_autoclean hello-c++-kde
   func_check_autoclean hello-c++-gnome2
+  func_check_autoclean hello-c++-gnome3
   func_check_autoclean hello-c++-wxwidgets
   func_check_autoclean hello-objc
   func_check_autoclean hello-objc-gnustep
@@ -209,6 +210,7 @@ func_check_distclean_all ()
  #func_check_distclean hello-c++-qt
  #func_check_distclean hello-c++-kde
  #func_check_distclean hello-c++-gnome2
+ #func_check_distclean hello-c++-gnome3
   func_check_distclean hello-c++-wxwidgets
   func_check_distclean hello-objc
   func_check_distclean hello-objc-gnustep
@@ -284,6 +286,7 @@ func_check_maintainerclean_all ()
  #func_check_maintainerclean hello-c++-qt
  #func_check_maintainerclean hello-c++-kde
  #func_check_maintainerclean hello-c++-gnome2
+ #func_check_maintainerclean hello-c++-gnome3
   func_check_maintainerclean hello-c++-wxwidgets
   func_check_maintainerclean hello-objc
   func_check_maintainerclean hello-objc-gnustep
@@ -362,6 +365,7 @@ func_check_maintainerclean_vpath_all ()
  #func_check_maintainerclean_vpath hello-c++-qt
  #func_check_maintainerclean_vpath hello-c++-kde
  #func_check_maintainerclean_vpath hello-c++-gnome2
+ #func_check_maintainerclean_vpath hello-c++-gnome3
   func_check_maintainerclean_vpath hello-c++-wxwidgets
   func_check_maintainerclean_vpath hello-objc
   func_check_maintainerclean_vpath hello-objc-gnustep
@@ -447,6 +451,7 @@ func_check_dist_all ()
  #func_check_dist hello-c++-qt
  #func_check_dist hello-c++-kde
  #func_check_dist hello-c++-gnome2
+ #func_check_dist hello-c++-gnome3
   func_check_dist hello-c++-wxwidgets
   func_check_dist hello-objc
   func_check_dist hello-objc-gnustep
@@ -532,6 +537,7 @@ func_check_dist_vpath_all ()
  #func_check_dist_vpath hello-c++-qt
  #func_check_dist_vpath hello-c++-kde
  #func_check_dist_vpath hello-c++-gnome2
+ #func_check_dist_vpath hello-c++-gnome3
   func_check_dist_vpath hello-c++-wxwidgets
   func_check_dist_vpath hello-objc
   func_check_dist_vpath hello-objc-gnustep
@@ -609,6 +615,7 @@ func_check_install_all ()
  #func_check_install hello-c++-qt
  #func_check_install hello-c++-kde
  #func_check_install hello-c++-gnome2
+ #func_check_install hello-c++-gnome3
   func_check_install hello-c++-wxwidgets
   func_check_install hello-objc
   func_check_install hello-objc-gnustep
@@ -683,6 +690,7 @@ func_check_uninstall_all ()
  #func_check_uninstall hello-c++-qt
  #func_check_uninstall hello-c++-kde
  #func_check_uninstall hello-c++-gnome2
+ #func_check_uninstall hello-c++-gnome3
   func_check_uninstall hello-c++-wxwidgets
   func_check_uninstall hello-objc
   func_check_uninstall hello-objc-gnustep
@@ -759,6 +767,7 @@ func_check_distcheck_all ()
  #func_check_distcheck hello-c++-qt
  #func_check_distcheck hello-c++-kde
  #func_check_distcheck hello-c++-gnome2
+ #func_check_distcheck hello-c++-gnome3
   func_check_distcheck hello-c++-wxwidgets
   func_check_distcheck hello-objc
   func_check_distcheck hello-objc-gnustep
@@ -810,6 +819,7 @@ func_check_all ()
   func_check hello-c++-qt
   func_check hello-c++-kde
   func_check hello-c++-gnome2
+  func_check hello-c++-gnome3
   func_check hello-c++-wxwidgets
   func_check hello-objc
   func_check hello-objc-gnustep
diff --git a/gettext-tools/examples/hello-c++-gnome3/INSTALL b/gettext-tools/examples/hello-c++-gnome3/INSTALL
new file mode 100644 (file)
index 0000000..57c91f6
--- /dev/null
@@ -0,0 +1,13 @@
+This example relies on:
+  - the GTK libraries (libgtk, libgdk), version 3.10 or later
+  - the glib libraries (libglib)
+  - the GTK / C++ bindings (libgtkmm)
+
+Installation:
+  ./autogen.sh
+  ./configure --prefix=/some/prefix
+  make
+  make install
+Cleanup:
+  make distclean
+  ./autoclean.sh
diff --git a/gettext-tools/examples/hello-c++-gnome3/Makefile.am b/gettext-tools/examples/hello-c++-gnome3/Makefile.am
new file mode 100644 (file)
index 0000000..041bb47
--- /dev/null
@@ -0,0 +1,58 @@
+# Example for use of GNU gettext.
+# This file is in the public domain.
+#
+# Makefile configuration - processed by automake.
+
+# General automake options.
+AUTOMAKE_OPTIONS = foreign no-dependencies
+ACLOCAL_AMFLAGS = -I m4
+
+# The list of subdirectories containing Makefiles.
+SUBDIRS = m4 po
+
+# The list of programs that are built.
+bin_PROGRAMS = hello
+
+# The source files of the 'hello' program.
+hello_SOURCES = hello.cc hello-resources.c
+
+# Define a C macro LOCALEDIR indicating where catalogs will be installed.
+DEFS = \
+  -DLOCALEDIR=$(localedir_c_make) \
+  @DEFS@
+
+# Make sure the gnome.h include file is found.
+AM_CPPFLAGS = $(GTKMM_CFLAGS)
+
+# Link time dependencies.
+LDADD = $(GTKMM_LIBS) @LIBINTL@
+
+# Compile assets into a C source and link it with the application.
+hello-resources.c: hello.gresource.xml hello.ui
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ \
+               --sourcedir=$(srcdir) --generate-source
+
+desktopdir = $(datadir)/applications
+desktop_DATA = hello.desktop
+
+# Merge translations back into a Desktop Entry file.
+
+# Note that the resulting file should be included in EXTRA_DIST and
+# processed earlier than the variable substitution below.  Otherwise,
+# the 'msgfmt' command will be required at compile-time.
+hello.desktop.in: hello.desktop.in.in
+       $(AM_V_GEN) $(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
+
+# Substitute variables in a Desktop Entry file.
+hello.desktop: hello.desktop.in
+       $(AM_V_GEN) sed -e 's|@bindir[@]|$(bindir)|g' $< > $@
+
+BUILT_SOURCES        = hello-resources.c hello.desktop
+CLEANFILES           =                   hello.desktop
+DISTCLEANFILES       =
+MAINTAINERCLEANFILES = hello-resources.c hello.desktop.in
+
+# Additional files to be distributed.
+EXTRA_DIST = autogen.sh autoclean.sh \
+       hello.desktop.in.in hello.desktop.in \
+       hello.gresource.xml hello.ui
diff --git a/gettext-tools/examples/hello-c++-gnome3/README b/gettext-tools/examples/hello-c++-gnome3/README
new file mode 100644 (file)
index 0000000..260f87d
--- /dev/null
@@ -0,0 +1,8 @@
+This example contains a simple "hello world" program.
+
+A more elaborate program that demonstrates advanced Gtk 3 features is
+not available here, because
+  - derived GObject classes have a number of pain points with gtkmm
+    (see <https://thinkingeek.com/2023/02/04/writing-gobjects-in-cpp/>),
+  - widget templates are not supported in gtkmm (see
+    <https://github.com/rofirrim/libadwaitamm/blob/main/demo/templatewidget.h>).
diff --git a/gettext-tools/examples/hello-c++-gnome3/autoclean.sh b/gettext-tools/examples/hello-c++-gnome3/autoclean.sh
new file mode 100755 (executable)
index 0000000..cca8992
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Example for use of GNU gettext.
+# This file is in the public domain.
+#
+# Script for cleaning all autogenerated files.
+
+test ! -f Makefile || make distclean
+rm -rf autom4te.cache
+
+# Files generated by "make" and distributed (see MAINTAINERCLEANFILES).
+rm -f hello-resources.c hello.desktop.in
+
+# Brought in by autopoint.
+rm -f ABOUT-NLS
+rm -f config.rpath
+rm -f m4/gettext.m4
+rm -f m4/build-to-host.m4
+rm -f m4/host-cpu-c-abi.m4
+rm -f m4/iconv.m4
+rm -f m4/intlmacosx.m4
+rm -f m4/lib-ld.m4
+rm -f m4/lib-link.m4
+rm -f m4/lib-prefix.m4
+rm -f m4/nls.m4
+rm -f m4/po.m4
+rm -f m4/progtest.m4
+rm -f po/Makefile.in
+rm -f po/remove-potcdate.sed
+
+# Generated by aclocal.
+rm -f aclocal.m4
+
+# Generated by autoconf.
+rm -f configure
+
+# Generated or brought in by automake.
+rm -f Makefile.in
+rm -f m4/Makefile.in
+rm -f compile
+rm -f install-sh
+rm -f missing
+rm -f config.guess
+rm -f config.sub
+rm -f po/*.pot
+rm -f po/stamp-po
+rm -f po/*.gmo
diff --git a/gettext-tools/examples/hello-c++-gnome3/autogen.sh b/gettext-tools/examples/hello-c++-gnome3/autogen.sh
new file mode 100755 (executable)
index 0000000..cf1a97e
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Example for use of GNU gettext.
+# This file is in the public domain.
+#
+# Script for regenerating all autogenerated files.
+
+autopoint -f # was: gettextize -f -c
+rm po/Makevars.template
+rm po/Rules-quot
+rm po/boldquot.sed
+rm po/en@boldquot.header
+rm po/en@quot.header
+rm po/insert-header.sed
+rm po/quot.sed
+
+aclocal -I m4
+
+autoconf
+
+automake -a -c
+
+cd po
+for f in *.po; do
+  if test -r "$f"; then
+    lang=`echo $f | sed -e 's,\.po$,,'`
+    msgfmt -c -o $lang.gmo $lang.po
+  fi
+done
+cd ..
diff --git a/gettext-tools/examples/hello-c++-gnome3/configure.ac b/gettext-tools/examples/hello-c++-gnome3/configure.ac
new file mode 100644 (file)
index 0000000..7bbd9bc
--- /dev/null
@@ -0,0 +1,54 @@
+dnl Example for use of GNU gettext.
+dnl This file is in the public domain.
+dnl
+dnl Configuration file - processed by autoconf.
+
+AC_INIT([hello-c++-gnome3], [0], , [hello-c++-gnome3])
+AC_CONFIG_SRCDIR([hello.cc])
+AM_INIT_AUTOMAKE([1.11])
+
+AC_PROG_CC
+AC_PROG_CXX
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.23])
+
+dnl Define localedir_c and localedir_c_make.
+gl_BUILD_TO_HOST_LOCALEDIR
+
+dnl Check GNOME specific stuff.
+dnl
+dnl If you have full GNOME development environment installed on your
+dnl system, you should be able to use the following macros:
+dnl
+dnl   AM_PATH_GLIB_2_0
+dnl   PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.10], ,
+dnl     [AC_MSG_ERROR([can't find gtk+-3.0])])
+dnl
+dnl Here, in gettext-tools/examples, we do the checks manually for
+dnl simplicity.
+
+AC_PATH_PROG([GLIB_COMPILE_RESOURCES], [glib-compile-resources])
+AS_IF([test -z "$GLIB_COMPILE_RESOURCES"], [
+  AC_MSG_ERROR([can't find glib-compile-resources])
+])
+
+AC_PATH_PROG([PKG_CONFIG], [pkg-config])
+AS_IF([test -z "$PKG_CONFIG"], [
+  AC_MSG_ERROR([can't find pkg-config])
+])
+
+GTKMM="gtkmm-3.0 >= 3.0"
+AS_IF(["$PKG_CONFIG" --exists "$GTKMM"], , [
+  AC_MSG_ERROR([can't find $GTKMM])
+])
+
+GTKMM_CFLAGS=`"$PKG_CONFIG" --cflags "$GTKMM"`
+AC_SUBST([GTKMM_CFLAGS])
+
+GTKMM_LIBS=`"$PKG_CONFIG" --libs "$GTKMM"`
+AC_SUBST([GTKMM_LIBS])
+
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([m4/Makefile])
+AC_CONFIG_FILES([po/Makefile.in])
+AC_OUTPUT
diff --git a/gettext-tools/examples/hello-c++-gnome3/hello.cc b/gettext-tools/examples/hello-c++-gnome3/hello.cc
new file mode 100644 (file)
index 0000000..1e8f9f8
--- /dev/null
@@ -0,0 +1,105 @@
+/* Example for use of GNU gettext.
+   This file is in the public domain.
+
+   Source code of the C++ program.  */
+
+
+/* Get GTKmm declarations.  */
+#include <gtkmm.h>
+#include <glib/gi18n.h>
+
+/* Get getpid() declaration.  */
+#if defined _WIN32 && !defined __CYGWIN__
+/* native Windows API */
+# include <process.h>
+# define getpid _getpid
+#else
+/* POSIX API */
+# include <unistd.h>
+#endif
+
+#define UI_PATH "/org/gnu/gettext/examples/hello/hello.ui"
+#define APPLICATION_ID "org.gnu.gettext.examples.hello"
+
+/* An ad-hoc struct for managing the main window.
+   (Not connected to the GObject type system.)  */
+struct HelloWindow
+{
+  Gtk::Window *window;
+  Gtk::Label *label;
+  Gtk::Button *button;
+  gsize label_id;
+  gchar *labels[3];
+};
+
+static void
+update_content (HelloWindow *hello_window)
+{
+  hello_window->label->set_label (hello_window->labels[hello_window->label_id]);
+  hello_window->label_id =
+    (hello_window->label_id + 1) % G_N_ELEMENTS (hello_window->labels);
+}
+
+static void
+clicked_callback (HelloWindow *hello_window)
+{
+  update_content (hello_window);
+}
+
+static void
+activate (Glib::RefPtr<Gtk::Application> application)
+{
+  /* Instantiate the UI.  */
+  Glib::RefPtr<Gtk::Builder> builder =
+    Gtk::Builder::create_from_resource (UI_PATH);
+
+  HelloWindow *hello_window = new HelloWindow ();
+  hello_window->window = nullptr;
+  builder->get_widget<Gtk::Window> ("main_window", hello_window->window);
+  hello_window->label = nullptr;
+  builder->get_widget<Gtk::Label> ("label", hello_window->label);
+  hello_window->button = nullptr;
+  builder->get_widget<Gtk::Button> ("button", hello_window->button);
+
+  /* Allow Pango markup in the label.  */
+  hello_window->label->set_use_markup (true);
+
+  /* Prepare various presentations of the label.  */
+  hello_window->label_id = 0;
+  gchar *line1 = g_strdup_printf ("<big>%s</big>", _("Hello world!"));
+  gchar *line2 =
+    g_strdup_printf (_("This program is running as process number %s."),
+                     g_strdup_printf ("<b>%d</b>", getpid ()));
+  hello_window->labels[0] = g_strdup_printf ("%s\n%s", line1, line2);
+  hello_window->labels[1] =
+    g_strdup_printf ("<big><u>%s</u></big>", _("This is another text"));
+  hello_window->labels[2] =
+    g_strdup_printf ("<big><i>%s</i></big>", _("This is yet another text"));
+
+  update_content (hello_window);
+
+  /* Make sure that the application runs for as long as this window is
+     still open.  */
+  application->add_window (*(hello_window->window));
+
+  hello_window->button->signal_clicked ()
+    .connect (sigc::bind (sigc::ptr_fun (clicked_callback), hello_window));
+  hello_window->window->present ();
+}
+
+int
+main (int argc, char *argv[])
+{
+  /* Initializations.  */
+  textdomain ("hello-c++-gnome3");
+  bindtextdomain ("hello-c++-gnome3", LOCALEDIR);
+
+  /* Create application.  */
+  Glib::RefPtr<Gtk::Application> application =
+    Gtk::Application::create (APPLICATION_ID, Gio::APPLICATION_FLAGS_NONE);
+  application->signal_activate ()
+    .connect (sigc::bind (sigc::ptr_fun (activate), application));
+
+  /* Start the application.  */
+  return application->run (argc, argv);
+}
diff --git a/gettext-tools/examples/hello-c++-gnome3/hello.desktop.in.in b/gettext-tools/examples/hello-c++-gnome3/hello.desktop.in.in
new file mode 100644 (file)
index 0000000..a31bf93
--- /dev/null
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Type=Application
+Name=Hello
+Comment=Hello, world!
+StartupNotify=true
+Exec=@bindir@/hello
diff --git a/gettext-tools/examples/hello-c++-gnome3/hello.gresource.xml b/gettext-tools/examples/hello-c++-gnome3/hello.gresource.xml
new file mode 100644 (file)
index 0000000..7a00dc8
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This file is in the public domain. -->
+<gresources>
+  <gresource prefix="/org/gnu/gettext/examples/hello">
+    <file preprocess="xml-stripblanks">hello.ui</file>
+  </gresource>
+</gresources>
diff --git a/gettext-tools/examples/hello-c++-gnome3/hello.ui b/gettext-tools/examples/hello-c++-gnome3/hello.ui
new file mode 100644 (file)
index 0000000..e142400
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This file is in the public domain. -->
+<interface>
+  <!-- interface-requires gtk+ 3.10 -->
+  <object class="GtkApplicationWindow" id="main_window">
+    <property name="title" translatable="yes">Example Application</property>
+    <property name="default-width">600</property>
+    <property name="default-height">400</property>
+    <child>
+      <object class="GtkBox" id="panel">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkAlignment" id="alignment">
+            <property name="visible">True</property>
+            <property name="xalign">0.5</property>
+            <property name="yalign">0.5</property>
+            <property name="xscale">0</property>
+            <property name="yscale">0</property>
+            <property name="vexpand">True</property>
+            <child>
+              <object class="GtkLabel" id="label">
+                <property name="visible">True</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkHButtonBox" id="buttonbar">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkButton" id="button">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Update text</property>
+                <property name="use_stock">False</property>
+              </object>
+              <packing>
+                <property name="pack-type">end</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/gettext-tools/examples/hello-c++-gnome3/m4/Makefile.am b/gettext-tools/examples/hello-c++-gnome3/m4/Makefile.am
new file mode 100644 (file)
index 0000000..7d516f0
--- /dev/null
@@ -0,0 +1,4 @@
+EXTRA_DIST = \
+  gettext.m4 build-to-host.m4 host-cpu-c-abi.m4 \
+  iconv.m4 intlmacosx.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 \
+  nls.m4 po.m4 progtest.m4
diff --git a/gettext-tools/examples/hello-c++-gnome3/po/LINGUAS b/gettext-tools/examples/hello-c++-gnome3/po/LINGUAS
new file mode 100644 (file)
index 0000000..dc4a82a
--- /dev/null
@@ -0,0 +1,5 @@
+# Example for use of GNU gettext.
+# This file is in the public domain.
+#
+# Set of available languages.
+af ast bg ca cs da de el eo es fi fr ga gl hr hu id it ja ka ky lv ms mt nb nl nn pl pt pt_BR ro ru sk sl sq sr sv ta tr uk vi zh_CN zh_HK zh_TW
diff --git a/gettext-tools/examples/hello-c++-gnome3/po/Makevars b/gettext-tools/examples/hello-c++-gnome3/po/Makevars
new file mode 100644 (file)
index 0000000..5c94986
--- /dev/null
@@ -0,0 +1,95 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+#
+# Copyright (C) 2003-2019 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to use, copy, distribute, and modify it.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = \
+  --keyword=_ --flag=_:1:pass-c-format \
+  --keyword=N_ --flag=N_:1:pass-c-format \
+  --flag=g_log:3:c-format --flag=g_logv:3:c-format \
+  --flag=g_error:1:c-format --flag=g_message:1:c-format \
+  --flag=g_critical:1:c-format --flag=g_warning:1:c-format \
+  --flag=g_print:1:c-format \
+  --flag=g_printerr:1:c-format \
+  --flag=g_strdup_printf:1:c-format --flag=g_strdup_vprintf:1:c-format \
+  --flag=g_printf_string_upper_bound:1:c-format \
+  --flag=g_snprintf:3:c-format --flag=g_vsnprintf:3:c-format \
+  --flag=g_string_sprintf:2:c-format \
+  --flag=g_string_sprintfa:2:c-format \
+  --flag=g_scanner_error:2:c-format \
+  --flag=g_scanner_warn:2:c-format
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Yoyodyne, Inc.
+
+# This tells whether or not to prepend "GNU " prefix to the package
+# name that gets inserted into the header of the $(DOMAIN).pot file.
+# Possible values are "yes", "no", or empty.  If it is empty, try to
+# detect it automatically by scanning the files in $(top_srcdir) for
+# "GNU packagename" string.
+PACKAGE_GNU = no
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+#   in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+#   understood.
+# - Strings which make invalid assumptions about notation of date, time or
+#   money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS = bug-gettext@gnu.org
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
+
+# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
+# context.  Possible values are "yes" and "no".  Set this to yes if the
+# package uses functions taking also a message context, like pgettext(), or
+# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
+USE_MSGCTXT = no
+
+# These options get passed to msgmerge.
+# Useful options are in particular:
+#   --previous            to keep previous msgids of translated messages
+MSGMERGE_OPTIONS =
+
+# These options get passed to msginit.
+# If you want to disable line wrapping when writing PO files, add
+# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
+# MSGINIT_OPTIONS.
+MSGINIT_OPTIONS =
+
+# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
+# has changed.  Possible values are "yes" and "no".  Set this to no if
+# the POT file is checked in the repository and the version control
+# program ignores timestamps.
+PO_DEPENDS_ON_POT = yes
+
+# This tells whether or not to forcibly update $(DOMAIN).pot and
+# regenerate PO files on "make dist".  Possible values are "yes" and
+# "no".  Set this to no if the POT file and PO files are maintained
+# externally.
+DIST_DEPENDS_ON_UPDATE_PO = yes
diff --git a/gettext-tools/examples/hello-c++-gnome3/po/POTFILES.in b/gettext-tools/examples/hello-c++-gnome3/po/POTFILES.in
new file mode 100644 (file)
index 0000000..77112c0
--- /dev/null
@@ -0,0 +1,7 @@
+# Example for use of GNU gettext.
+# This file is in the public domain.
+#
+# List of files which contain translatable strings.
+hello.cc
+hello.desktop.in.in
+hello.ui
index 12ddbc1017fa65d82c6fbdedf977311d1623e7a1..9663b3f19c7d3741601340864e36c139fae720ab 100644 (file)
@@ -36,6 +36,9 @@ POTFILES = \
   hello-c++-kde/hellowindow.h \
   hello-c++-kde/hellowindow.cc \
   hello-c++-gnome2/hello.cc \
+  hello-c++-gnome3/hello.cc \
+  hello-c++-gnome3/hello.desktop.in.in \
+  hello-c++-gnome3/hello.ui \
   hello-c++-wxwidgets/hello.cc \
   hello-objc/hello.m \
   hello-objc-gnustep/main.m \
@@ -76,6 +79,7 @@ SMALLPOTS = \
   hello-c++-qt.pot \
   hello-c++-kde.pot \
   hello-c++-gnome2.pot \
+  hello-c++-gnome3.pot \
   hello-c++-wxwidgets.pot \
   hello-objc.pot \
   hello-objc-gnustep.pot \
@@ -272,6 +276,9 @@ hello-c++-kde.pot : $(POTFILES_DEPS)
 hello-c++-gnome2.pot : $(POTFILES_DEPS)
        $(USE_BUILT_PROGS) $(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-c++-gnome2
 
+hello-c++-gnome3.pot : $(POTFILES_DEPS)
+       $(USE_BUILT_PROGS) $(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-c++-gnome3
+
 hello-c++-wxwidgets.pot : $(POTFILES_DEPS)
        $(USE_BUILT_PROGS) $(SHELL) '$(srcdir)/xsmallpot.sh' '$(srcdir)' hello-c++-wxwidgets
 
@@ -428,6 +435,7 @@ SMALLPOFILES_FOR_lang = \
   $(srcdir)/../hello-c++-qt/po/$$lang.po \
   $(srcdir)/../hello-c++-kde/po/$$lang.po \
   $(srcdir)/../hello-c++-gnome2/po/$$lang.po \
+  $(srcdir)/../hello-c++-gnome3/po/$$lang.po \
   $(srcdir)/../hello-c++-wxwidgets/po/$$lang.po \
   $(srcdir)/../hello-objc/po/$$lang.po \
   $(srcdir)/../hello-objc-gnustep/po/$$lang.po \
@@ -477,6 +485,9 @@ $(srcdir)/../hello-c++-kde/po/$(LL).po: $(srcdir)/hello-c++-kde.pot $(srcdir)/$(
 $(srcdir)/../hello-c++-gnome2/po/$(LL).po: $(srcdir)/hello-c++-gnome2.pot $(srcdir)/$(LL).po
        $(USE_BUILT_PROGS) cd $(srcdir) && $(SHELL) mmsmallpo.sh hello-c++-gnome2 $(LL)
 
+$(srcdir)/../hello-c++-gnome3/po/$(LL).po: $(srcdir)/hello-c++-gnome3.pot $(srcdir)/$(LL).po
+       $(USE_BUILT_PROGS) cd $(srcdir) && $(SHELL) mmsmallpo.sh hello-c++-gnome3 $(LL)
+
 $(srcdir)/../hello-c++-wxwidgets/po/$(LL).po: $(srcdir)/hello-c++-wxwidgets.pot $(srcdir)/$(LL).po
        $(USE_BUILT_PROGS) cd $(srcdir) && $(SHELL) mmsmallpo.sh hello-c++-wxwidgets $(LL)