From a9e0a03817c421da14093d05e41970da740c44a0 Mon Sep 17 00:00:00 2001 From: Vladimir Nadvornik Date: Mon, 15 Jun 2009 20:50:35 +0000 Subject: [PATCH] use intltool for desktop file translation - desktop files are translated via .po files together with other strings - make update-po is replaced with intltool-update [lang] --- Makefile.am | 4 ++- autogen.sh | 11 ++++-- configure.in | 2 ++ geeqie.desktop | 7 ---- plugins/rotate/Makefile.am | 6 ++-- plugins/rotate/rotate.desktop.in | 19 +++++++++++ plugins/symlink/Makefile.am | 6 ++-- plugins/symlink/symlink.desktop | 1 - plugins/symlink/symlink.desktop.in | 20 +++++++++++ po/Makefile.in.in.patch | 54 ------------------------------ po/POTFILES.in | 3 ++ po/README | 4 +-- 12 files changed, 65 insertions(+), 72 deletions(-) create mode 100644 plugins/rotate/rotate.desktop.in create mode 100644 plugins/symlink/symlink.desktop.in delete mode 100644 po/Makefile.in.in.patch diff --git a/Makefile.am b/Makefile.am index db9144c5..21006718 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,7 +11,9 @@ readmedir = @readmedir@ readme_DATA = README COPYING ChangeLog TODO README.lirc desktopdir = $(datadir)/applications -desktop_DATA = geeqie.desktop +desktop_in_files = geeqie.desktop.in +desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) +@INTLTOOL_DESKTOP_RULE@ icondir = $(datadir)/pixmaps icon_DATA = geeqie.png diff --git a/autogen.sh b/autogen.sh index 8a188e3d..ef64ec11 100755 --- a/autogen.sh +++ b/autogen.sh @@ -35,6 +35,12 @@ DIE=0 } } +(intltoolize --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`intltoolize' installed" + DIE=1 +} + (automake --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`automake' installed." @@ -99,9 +105,8 @@ do test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 echo "Running glib-gettextize..." echo "no" | glib-gettextize --force --copy - if [ -r po/Makefile.in.in.patch ]; then - patch po/Makefile.in.in < po/Makefile.in.in.patch - fi + echo "Running intltoolize" + intltoolize --copy --force --automake echo "Making $dr/aclocal.m4 writable ..." test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 fi diff --git a/configure.in b/configure.in index f4327a3a..e52de57c 100644 --- a/configure.in +++ b/configure.in @@ -128,6 +128,8 @@ AC_PROG_CC AC_PROG_CXX AC_STDC_HEADERS AC_ARG_PROGRAM +IT_PROG_INTLTOOL([0.35.0]) + dnl checks for functions AC_CHECK_FUNCS(strverscmp access fsync fflush) diff --git a/geeqie.desktop b/geeqie.desktop index 4f582b8a..e74a0dd6 100644 --- a/geeqie.desktop +++ b/geeqie.desktop @@ -1,14 +1,7 @@ [Desktop Entry] Name=Geeqie GenericName=Image Viewer -GenericName[et]=Piltide vaatur -GenericName[tr]=Resim göstericisi -GenericName[fr]=Explorateur d'images -GenericName[hu]=Képnéző -GenericName[es]=Visor de imágenes Comment=View and manage images -Comment[hu]=Képek megjelenítése és rendszerezése -Comment[es]=Visualiza y administra imágenes Exec=geeqie -r %F Icon=geeqie Type=Application diff --git a/plugins/rotate/Makefile.am b/plugins/rotate/Makefile.am index 97cf9b01..284cdec2 100644 --- a/plugins/rotate/Makefile.am +++ b/plugins/rotate/Makefile.am @@ -1,7 +1,9 @@ dist_pkglib_SCRIPTS = geeqie-rotate -qq_desktopdir = $(pkgdatadir)/applications -qq_desktop_DATA = rotate.desktop +gq_desktopdir = $(pkgdatadir)/applications +gq_desktop_in_files = rotate.desktop.in +gq_desktop_DATA = $(gq_desktop_in_files:.desktop.in=.desktop) +@INTLTOOL_DESKTOP_RULE@ EXTRA_DIST = $(qq_desktop_DATA) diff --git a/plugins/rotate/rotate.desktop.in b/plugins/rotate/rotate.desktop.in new file mode 100644 index 00000000..a403591a --- /dev/null +++ b/plugins/rotate/rotate.desktop.in @@ -0,0 +1,19 @@ +[Desktop Entry] +Version=1.0 +Type=Application +_Name=Apply the orientation to image content + +# call the helper script +Exec=geeqie-rotate %f + +# Desktop files that are usable only in Geeqie should be marked like this: +Categories=X-Geeqie; +OnlyShowIn=X-Geeqie; + +# Show in menu "Edit/Orientation" +X-Geeqie-Menu-Path=EditMenu/OrientationMenu + +# It can be made verbose +# X-Geeqie-Verbose=true + +MimeType=image/jpeg;image/png;image/tiff; diff --git a/plugins/symlink/Makefile.am b/plugins/symlink/Makefile.am index 4d1e71ce..161cddef 100644 --- a/plugins/symlink/Makefile.am +++ b/plugins/symlink/Makefile.am @@ -1,7 +1,9 @@ dist_pkglib_SCRIPTS = geeqie-symlink -qq_desktopdir = $(pkgdatadir)/applications -qq_desktop_DATA = symlink.desktop +gq_desktopdir = $(pkgdatadir)/applications +gq_desktop_in_files = symlink.desktop.in +gq_desktop_DATA = $(gq_desktop_in_files:.desktop.in=.desktop) +@INTLTOOL_DESKTOP_RULE@ EXTRA_DIST = \ $(qq_desktop_DATA) diff --git a/plugins/symlink/symlink.desktop b/plugins/symlink/symlink.desktop index 88bb3da4..f82a706e 100644 --- a/plugins/symlink/symlink.desktop +++ b/plugins/symlink/symlink.desktop @@ -2,7 +2,6 @@ Version=1.0 Type=Application Name=Symlink -#Name[cs]= # call the helper script Exec=geeqie-symlink %f diff --git a/plugins/symlink/symlink.desktop.in b/plugins/symlink/symlink.desktop.in new file mode 100644 index 00000000..678d8dbc --- /dev/null +++ b/plugins/symlink/symlink.desktop.in @@ -0,0 +1,20 @@ +[Desktop Entry] +Version=1.0 +Type=Application +_Name=Symlink + +# call the helper script +Exec=geeqie-symlink %f + +# Desktop files that are usable only in Geeqie should be marked like this: +Categories=X-Geeqie; +OnlyShowIn=X-Geeqie; + +# Show in menu "File" +X-Geeqie-Menu-Path=FileMenu/FileOpsSection + +# This is a filter - $GEEQIE_DESTINATION is required +X-Geeqie-Filter=true + +# It can be made verbose +# X-Geeqie-Verbose=true diff --git a/po/Makefile.in.in.patch b/po/Makefile.in.in.patch deleted file mode 100644 index 03b8b27e..00000000 --- a/po/Makefile.in.in.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- Makefile.in.in 2009-04-28 23:27:08.000000000 +0200 -+++ Makefile.in.in.new 2009-04-28 23:25:22.000000000 +0200 -@@ -92,7 +92,7 @@ - all-yes: $(CATALOGS) - all-no: - --$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES) -+$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in - $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \ - --add-comments --keyword=_ --keyword=N_ \ - --flag=g_strdup_printf:1:c-format \ -@@ -216,8 +216,31 @@ - || cp -p $(srcdir)/$$file $(distdir); \ - done - --update-po: Makefile -- $(MAKE) $(GETTEXT_PACKAGE).pot -+### Updating po and gmo files -+# -+# Update by merging all .po files with the .po template master file. -+# -+# It is possible to update only a single .po file by setting the PO variable to -+# either or .po when calling make. Example: make update-po PO=is -+ -+update-po: Makefile $(srcdir)/$(GETTEXT_PACKAGE).pot -+ @cd $(srcdir); \ -+ $(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(CATALOGS))), \ -+ echo -n "$(lang): "; \ -+ if $(MSGMERGE) $(lang).po $(srcdir)/$(GETTEXT_PACKAGE).pot -o $(lang).new.po; then \ -+ mv -f $(lang).new.po $(lang).po; \ -+ else \ -+ echo "msgmerge failed!"; \ -+ rm -f $(lang).new.po; \ -+ fi; \ -+ ) -+ $(MAKE) update-gmo -+ -+update-gmo: Makefile $(CATALOGS) -+ @: -+ -+update-po-orig: Makefile -+ $(MAKE) $(srcdir)/$(GETTEXT_PACKAGE).pot - tmpdir=`pwd`; \ - cd $(srcdir); \ - catalogs='$(CATALOGS)'; \ -@@ -225,7 +248,7 @@ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - echo "$$lang:"; \ -- if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \ -+ if $(MSGMERGE) $$lang.po $(srcdir)/$(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \ - if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ - rm -f $$tmpdir/$$lang.new.po; \ - else \ diff --git a/po/POTFILES.in b/po/POTFILES.in index 0f374bfc..3e1818e9 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,3 +1,6 @@ +./geeqie.desktop.in +./plugins/rotate/rotate.desktop.in +./plugins/symlink/symlink.desktop.in ./src/advanced_exif.c ./src/bar.c ./src/bar_comment.c diff --git a/po/README b/po/README index 540d6a81..12a5af4c 100644 --- a/po/README +++ b/po/README @@ -4,8 +4,8 @@ Basically: Add your language code to the ALL_LINGUAS= line in configure.in, then get started translating the strings in your ??.po file. Note: The strings for debug output is intentionally not marked for translation. -To update a specific translation, one may use make update-po PO=[lang] (ie. -make update-po PO=fr). +To update a specific translation, one may use intltool-update [lang] (ie. +intltool-update fr). To update all translation files, use make update-po. You should only use it when needed (before a release or when there were many changes in source code). -- 2.20.1