[gimp/wip/nielsdg/desktop-gettext] desktop: Rename for org.gimp.GIMP, use gettext



commit 29fe933284069bcc9ffce8ff66a21b142f1941c6
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Mon May 11 19:40:06 2020 +0200

    desktop: Rename for org.gimp.GIMP, use gettext
    
    Use gettext rather than intltool to generate the translated desktop
    file.

 autogen.sh                                         | 16 ----
 build/flatpak/org.gimp.GIMP-nightly.json           |  1 -
 configure.ac                                       | 15 +---
 desktop/Makefile.am                                | 19 ++---
 desktop/meson.build                                | 97 ++++++++--------------
 ...p.desktop.in.in => org.gimp.GIMP.desktop.in.in} |  8 +-
 po/POTFILES.in                                     |  2 -
 7 files changed, 50 insertions(+), 108 deletions(-)
---
diff --git a/autogen.sh b/autogen.sh
index 13b819f46d..3bad9a2e77 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -13,7 +13,6 @@ AUTOMAKE_RECOMMENDED_VERSION=1.16
 
 AUTOCONF_REQUIRED_VERSION=2.54
 AUTOMAKE_REQUIRED_VERSION=1.13.0
-INTLTOOL_REQUIRED_VERSION=0.40.1
 LIBTOOL_REQUIRED_VERSION=1.5
 LIBTOOL_WIN32_REQUIRED_VERSION=2.2
 
@@ -189,21 +188,6 @@ if test x$AUTOMAKE != x; then
 fi
 
 
-printf "checking for intltool >= $INTLTOOL_REQUIRED_VERSION ... "
-if (intltoolize --version) < /dev/null > /dev/null 2>&1; then
-    VER=`intltoolize --version \
-         | grep intltoolize | sed "s/.* \([0-9.]*\)/\1/"`
-    check_version $VER $INTLTOOL_REQUIRED_VERSION
-else
-    echo
-    echo "  You must have intltool installed to compile $PROJECT."
-    echo "  Get the latest version from"
-    echo "  ftp://ftp.gnome.org/pub/GNOME/sources/intltool/";
-    echo
-    DIE=1
-fi
-
-
 printf "checking for xsltproc ... "
 if (xsltproc --version) < /dev/null > /dev/null 2>&1; then
     echo "yes"
diff --git a/build/flatpak/org.gimp.GIMP-nightly.json b/build/flatpak/org.gimp.GIMP-nightly.json
index 4d54de136b..d44965ff0f 100644
--- a/build/flatpak/org.gimp.GIMP-nightly.json
+++ b/build/flatpak/org.gimp.GIMP-nightly.json
@@ -6,7 +6,6 @@
     "sdk": "org.gnome.Sdk",
     "command": "gimp-2.99",
     "separate-locales": false,
-    "rename-desktop-file": "gimp.desktop",
     "rename-icon": "gimp",
     "finish-args": ["--share=ipc", "--share=network",
                     "--socket=x11", "--socket=wayland",
diff --git a/configure.ac b/configure.ac
index 34a1b93f80..beca12b830 100644
--- a/configure.ac
+++ b/configure.ac
@@ -167,7 +167,6 @@ GEXIV2_REQUIRED_VERSION=gexiv2_required_version
 GLIB_REQUIRED_VERSION=glib_required_version
 GTK_REQUIRED_VERSION=gtk_required_version
 HARFBUZZ_REQUIRED_VERSION=harfbuzz_required_version
-INTLTOOL_REQUIRED_VERSION=intltool_required_version
 LCMS_REQUIRED_VERSION=lcms_required_version
 LIBHEIF_REQUIRED_VERSION=libheif_required_version
 LIBLZMA_REQUIRED_VERSION=liblzma_required_version
@@ -200,7 +199,6 @@ AC_SUBST(GEXIV2_REQUIRED_VERSION)
 AC_SUBST(GLIB_REQUIRED_VERSION)
 AC_SUBST(GTK_REQUIRED_VERSION)
 AC_SUBST(HARFBUZZ_REQUIRED_VERSION)
-AC_SUBST(INTLTOOL_REQUIRED_VERSION)
 AC_SUBST(LCMS_REQUIRED_VERSION)
 AC_SUBST(LIBHEIF_REQUIRED_VERSION)
 AC_SUBST(LIBLZMA_REQUIRED_VERSION)
@@ -246,11 +244,6 @@ AC_SUBST(GETTEXT_PACKAGE)
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
                    [The prefix for our gettext translation domains.])
 
-# work around intltool-update issues during 'make distcheck'
-AS_IF([test "x$0" != "x./configure"], [
-        AC_SUBST([INTLTOOL_UPDATE], [/bin/true])
-])
-
 # Determine a C compiler to use
 AC_PROG_CC
 AX_PROG_CC_FOR_BUILD
@@ -654,8 +647,9 @@ m4_define([add_deps_error], [
 # Internationalisation
 ######################
 
-IT_PROG_INTLTOOL(intltool_required_version)
-AM_GLIB_GNU_GETTEXT
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.19.8])
+
 
 # Testing xgettext version since we had some problem with localizing script-fu. See bug 720052.
 AC_MSG_CHECKING([for xgettext version (>= xgettext_required_version)])
@@ -3132,9 +3126,6 @@ m4_define([generate_po_makefile], [
 
   AC_CONFIG_COMMANDS([$1/stamp-it],
   [[
-    if  ! grep "^# INTLTOOL_MAKEFILE$" "$1/Makefile.in" > /dev/null ; then
-       as_fn_error $? "$1/Makefile.in.in was not created by intltoolize." "$LINENO" 5
-    fi
     rm -f "$1/stamp-it" "$1/POTFILES"
     sed -e '/^#/d' -e 's/^[[].*] *//' \
         -e '/^[        ]*$/d'        \
diff --git a/desktop/Makefile.am b/desktop/Makefile.am
index 520dcfe68e..c84782123b 100644
--- a/desktop/Makefile.am
+++ b/desktop/Makefile.am
@@ -1,15 +1,19 @@
 ## Makefile.am for gimp/desktop
 
 desktop_in_files = \
-       gimp.desktop.in.in
+       org.gimp.GIMP.desktop.in.in
 
 desktop_files = $(desktop_in_files:.desktop.in.in=.desktop)
+$(desktop_files): $(desktop_in_files)
+       $(AM_V_GEN) $(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
 
 appstream_in_files = \
        org.gimp.GIMP.appdata.xml.in    \
        gimp-data-extras.metainfo.xml.in
 
-appstream_files = $(appstream_in_files:.xml.in=.xml)
+appstream_XML = $(appstream_in_files:.xml.in=.xml)
+$(appstream_XML): $(appstream_in_files)
+       $(AM_V_GEN) $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
 
 if DESKTOP_DATADIR
 
@@ -17,7 +21,7 @@ applicationsdir = $(DESKTOP_DATADIR)/applications
 applications_DATA = $(desktop_files)
 
 appdatadir = $(DESKTOP_DATADIR)/metainfo
-appdata_DATA = $(appstream_files)
+appdata_DATA = $(appstream_XML)
 
 icons16dir = $(DESKTOP_DATADIR)/icons/hicolor/16x16/apps
 icons16_DATA = 16x16/gimp.png
@@ -58,14 +62,9 @@ EXTRA_DIST = \
        256x256/gimp.png
 
 
-DISTCLEANFILES = $(desktop_files) $(appstream_files)
+DISTCLEANFILES = $(desktop_files) $(appstream_XML)
 
-@INTLTOOL_XML_RULE@
-
-gimp.desktop: gimp.desktop.in $(wildcard $(top_srcdir)/po/*.po)
-       $(INTLTOOL_MERGE) $(top_srcdir)/po $< $(@) -d -u -c $(top_builddir)/po/.intltool-merge-cache
-
-validate: gimp.desktop
+validate: $(desktop_files)
        ( dfvalidate=`which desktop-file-validate`; \
          if test x$$dfvalidate != x && test -x $$dfvalidate; then \
             $$dfvalidate $< || ( echo "* $< INVALID *"; exit 1 ) \
diff --git a/desktop/meson.build b/desktop/meson.build
index 2b34ad7d59..a3cc6e8b4f 100644
--- a/desktop/meson.build
+++ b/desktop/meson.build
@@ -15,79 +15,50 @@ foreach size : sizes
   )
 endforeach
 
-desktopfilename = 'gimp.desktop'
+desktop_conf = {
+  'GIMP_COMMAND':     gimp_command,
+  'GIMP_VERSION':     gimp_version,
+  'GIMP_APP_VERSION': gimp_app_version,
+  'MIME_TYPES':       ';'.join(MIMEtypes),
+  'BUG_REPORT_URL':   bug_report_url,
+}
 
-desktop_conf = configuration_data()
-desktop_conf.set('GIMP_COMMAND',      gimp_command)
-desktop_conf.set('GIMP_VERSION',      gimp_version)
-desktop_conf.set('GIMP_APP_VERSION',  gimp_app_version)
-desktop_conf.set('MIME_TYPES',        ';'.join(MIMEtypes))
-desktop_conf.set('BUG_REPORT_URL',    bug_report_url)
-
-desktopfilein = configure_file(
-  input : desktopfilename+'.in.in',
-  output: desktopfilename+'.in',
-  configuration: desktop_conf,
-)
-
-desktopfile = custom_target(desktopfilename,
-  input : [ desktopfilein, ],
-  output: [ desktopfilename, ],
-  command: [
-    intltool_merge,
-    po_dir,
-    '@INPUT@',
-    '@OUTPUT@',
-    '--desktop-style',
-    '--utf8',
-    '--cache=' + '@OUTDIR@' / 'intltool-merge-cache',
-  ],
+desktopfile = i18n.merge_file(
+  input: configure_file(
+    input: 'org.gimp.GIMP.desktop.in.in',
+    output: '@BASENAME@',
+    configuration: desktop_conf,
+  ),
+  output: '@BASENAME@',
+  type: 'desktop',
+  po_dir: po_dir,
   install: true,
   install_dir: get_option('datadir') / 'applications',
 )
 
-appdatafilename = 'org.gimp.GIMP.appdata.xml'
-appdatafilein = configure_file(
-  input : appdatafilename+'.in.in',
-  output: appdatafilename+'.in',
-  configuration: desktop_conf,
-)
-appdatafile = custom_target(appdatafilename,
-  input : [ appdatafilein, ],
-  output: [ appdatafilename, ],
-  command: [
-    intltool_merge,
-    po_dir,
-    '@INPUT@',
-    '@OUTPUT@',
-    '--xml-style',
-    '--utf8',
-    '--cache=' + '@OUTDIR@' / 'intltool-merge-cache',
-  ],
+appdatafile = i18n.merge_file(
+  input: configure_file(
+    input: 'org.gimp.GIMP.appdata.xml.in.in',
+    output: '@BASENAME@',
+    configuration: desktop_conf,
+  ),
+  output: '@BASENAME@',
+  type: 'xml',
+  po_dir: po_dir,
   install: true,
   install_dir: get_option('datadir') / 'metainfo',
 )
 
-metainfofilename = 'gimp-data-extras.metainfo.xml'
-metainfofilein = configure_file(
-  input : metainfofilename+'.in.in',
-  output: metainfofilename+'.in',
-  configuration: desktop_conf,
-)
-metainfofile = custom_target(metainfofilename,
-  input : [ metainfofilein, ],
-  output: [ metainfofilename, ],
-  command: [
-    intltool_merge,
-    po_dir,
-    '@INPUT@',
-    '@OUTPUT@',
-    '--xml-style',
-    '--utf8',
-    '--cache=' + '@OUTDIR@' / 'intltool-merge-cache',
-  ],
+metainfofile = i18n.merge_file(
+  input: configure_file(
+    input: 'gimp-data-extras.metainfo.xml.in.in',
+    output: '@BASENAME@',
+    configuration: desktop_conf,
+  ),
+  output: '@BASENAME@',
+  po_dir: po_dir,
   install: true,
-  install_dir: get_option('datadir') / 'appdata',
+  install_dir: get_option('datadir') / 'metainfo',
 )
 
 if desktop_validate.found()
diff --git a/desktop/gimp.desktop.in.in b/desktop/org.gimp.GIMP.desktop.in.in
similarity index 69%
rename from desktop/gimp.desktop.in.in
rename to desktop/org.gimp.GIMP.desktop.in.in
index c0a98e9c6c..4b8f099e59 100644
--- a/desktop/gimp.desktop.in.in
+++ b/desktop/org.gimp.GIMP.desktop.in.in
@@ -1,11 +1,11 @@
 [Desktop Entry]
 Version=1.0
 Type=Application
-_Name=GNU Image Manipulation Program
-_GenericName=Image Editor
-_Comment=Create images and edit photographs
+Name=GNU Image Manipulation Program
+GenericName=Image Editor
+Comment=Create images and edit photographs
 # Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list 
MUST also end with a semicolon!
-_Keywords=GIMP;graphic;design;illustration;painting;
+Keywords=GIMP;graphic;design;illustration;painting;
 Exec=@GIMP_COMMAND@ %U
 TryExec=gimp-@GIMP_APP_VERSION@
 Icon=gimp
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 3336de7004..6c6dbb744e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,8 +1,6 @@
 # Files from the Gimp distribution which have already been
 # marked to allow runtime translation of messages
 
-[encoding: UTF-8]
-
 desktop/org.gimp.GIMP.appdata.xml.in.in
 desktop/gimp-data-extras.metainfo.xml.in.in
 desktop/gimp.desktop.in.in


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