Fix #1788: Instructions related to translation update are outdated
authorColin Clark <[email protected]>
Tue, 8 Jul 2025 12:01:45 +0000 (13:01 +0100)
committerColin Clark <[email protected]>
Tue, 8 Jul 2025 12:01:45 +0000 (13:01 +0100)
https://github.com/BestImageViewer/geeqie/issues/1788

- Update ./README.md
- Create ./po/README.md
- Create script to update a .po file
- Remove redundant files

README.md
po/ChangeLog [deleted file]
po/POTFILES [deleted file]
po/README [deleted file]
po/README.md [new file with mode: 0644]
po/regen_potfiles.sh [deleted file]
po/update-translation.sh [new file with mode: 0755]

index a424d5e9e23e9a2a1a711cdf7f67ebe2f7826fb5..dfd6102bc88274f644e3be6a6585e697c3ece875 100644 (file)
--- a/README.md
+++ b/README.md
@@ -248,6 +248,10 @@ chmod +x geeqie-install-debian.sh
 ./geeqie-install-debian.sh --list
 ```
 
+### Translators
+
+Please see file `./po/README.md`.
+
 ### Code hackers
 
 If you plan on making any major changes to the code that will be offered for
diff --git a/po/ChangeLog b/po/ChangeLog
deleted file mode 100644 (file)
index 677cf4d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-2002-04-25  gettextize  <[email protected]>
-
-       * Makefile.in.in: Upgrade to gettext-0.10.38.
-
-2002-01-27  gettextize  <[email protected]>
-
-       * Makefile.in.in: Upgrade to gettext-0.10.38.
-       * cat-id-tbl.c: Remove file.
-       * stamp-cat-id: Remove file.
-
diff --git a/po/POTFILES b/po/POTFILES
deleted file mode 100644 (file)
index e2960ac..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-org.geeqie.Geeqie.appdata.xml.in
-org.geeqie.Geeqie.desktop.in
-plugins/camera-import/org.geeqie.camera-import.desktop.in
-plugins/exif-datetime-to-file/org.geeqie.exif-datetime-to-file.desktop.in
-plugins/export-jpeg/org.geeqie.export-jpeg.desktop.in
-plugins/image-crop/org.geeqie.image-crop.desktop.in
-plugins/open-with/org.geeqie.open-with.desktop.in
-plugins/org.geeqie.template.desktop.in
-plugins/random-image/org.geeqie.random-image.desktop.in
-plugins/resize-image/org.geeqie.resize-image.desktop.in
-plugins/rotate/org.geeqie.rotate.desktop.in
-plugins/symlink/org.geeqie.symlink.desktop.in
-plugins/tethered-photography/org.geeqie.tethered-photography.desktop.in
-plugins/video-player/org.geeqie.video-player.desktop.in
-src/advanced-exif.cc
-src/archives.cc
-src/bar.cc
-src/bar-comment.cc
-src/bar-exif.cc
-src/bar-gps.cc
-src/bar-histogram.cc
-src/bar-keywords.cc
-src/bar-rating.cc
-src/bar-sort.cc
-src/cache.cc
-src/cache-loader.cc
-src/cache-maint.cc
-src/cellrenderericon.cc
-src/collect.cc
-src/collect-dlg.cc
-src/collect-io.cc
-src/collect-table.cc
-src/color-man.cc
-src/compat.cc
-src/debug.cc
-src/desktop-file.cc
-src/dnd.cc
-src/dupe.cc
-src/editors.cc
-src/exif.cc
-src/exif-common.cc
-src/exiv2.cc
-src/filecache.cc
-src/filedata.cc
-src/filedata/filedata.cc
-src/filedata/filelist.cc
-src/filefilter.cc
-src/format-canon.cc
-src/format-fuji.cc
-src/format-nikon.cc
-src/format-olympus.cc
-src/format-raw.cc
-src/fullscreen.cc
-src/histogram.cc
-src/history-list.cc
-src/image.cc
-src/image-load.cc
-src/image-load-collection.cc
-src/image-load-cr3.cc
-src/image-load-dds.cc
-src/image-load-djvu.cc
-src/image-load-external.cc
-src/image-load-ffmpegthumbnailer.cc
-src/image-load-gdk.cc
-src/image-load-heif.cc
-src/image-load-j2k.cc
-src/image-load-jpeg.cc
-src/image-load-jpegxl.cc
-src/image-load-libraw.cc
-src/image-load-pdf.cc
-src/image-load-psd.cc
-src/image-load-svgz.cc
-src/image-load-tiff.cc
-src/image-load-webp.cc
-src/image-load-zxscr.cc
-src/image-overlay.cc
-src/img-view.cc
-src/jpeg-parser.cc
-src/keymap-template.cc
-src/layout.cc
-src/layout-config.cc
-src/layout-image.cc
-src/layout-util.cc
-src/logwindow.cc
-src/lua.cc
-src/main.cc
-src/md5-util.cc
-src/menu.cc
-src/metadata.cc
-src/misc.cc
-src/options.cc
-src/osd.cc
-src/pan-view/pan-calendar.cc
-src/pan-view/pan-folder.cc
-src/pan-view/pan-grid.cc
-src/pan-view/pan-item.cc
-src/pan-view/pan-timeline.cc
-src/pan-view/pan-util.cc
-src/pan-view/pan-view.cc
-src/pan-view/pan-view-filter.cc
-src/pan-view/pan-view-search.cc
-src/pixbuf-renderer.cc
-src/pixbuf-util.cc
-src/preferences.cc
-src/print.cc
-src/rcfile.cc
-src/remote.cc
-src/renderer-tiles.cc
-src/search-and-run.cc
-src/search.cc
-src/secure-save.cc
-src/shortcuts.cc
-src/similar.cc
-src/slideshow.cc
-src/tests/filedata/filedata.cc
-src/tests/filedata/filelist.cc
-src/tests/pixbuf-util.cc
-src/third-party/whereami.cc
-src/third-party/zonedetect.cc
-src/thumb.cc
-src/thumb-standard.cc
-src/toolbar.cc
-src/trash.cc
-src/ui/appimage-notification.ui
-src/ui-bookmark.cc
-src/ui-fileops.cc
-src/ui-help.cc
-src/ui-menu.cc
-src/ui/menu-classic.ui
-src/ui/menu-hamburger.ui
-src/ui-misc.cc
-src/ui-pathsel.cc
-src/ui/search-and-run.ui
-src/ui-tabcomp.cc
-src/ui-tree-edit.cc
-src/ui-utildlg.cc
-src/uri-utils.cc
-src/utilops.cc
-src/view-dir.cc
-src/view-dir-list.cc
-src/view-dir-tree.cc
-src/view-file/view-file.cc
-src/view-file/view-file-icon.cc
-src/view-file/view-file-list.cc
-src/window.cc
diff --git a/po/README b/po/README
deleted file mode 100644 (file)
index 132ccfb..0000000
--- a/po/README
+++ /dev/null
@@ -1,22 +0,0 @@
-Translators create a translation by creating the appropriate .po file in the /po
-directory.
-
-Please see the gettext info pages for an overview and instructions.
-
-Basically:
-- Add your language code to the LINGUAS file
-- 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:
-- 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).
-
-
-Helper scripts:
-
-gen_translations_stats.sh      generate statistics about translations
-regen_potfiles.sh              generate a patch to sync POTFILES.in with current source files
diff --git a/po/README.md b/po/README.md
new file mode 100644 (file)
index 0000000..312f6a5
--- /dev/null
@@ -0,0 +1,33 @@
+# Geeqie Readme for translators
+
+## Creating a new translation
+
+If you wish to contribute a new language, you must first create the appropriate language file - for example `de.po` is the language file for the German language.
+
+The file prefix is determined by your locale. You can see your locale by executing the command `locale` from a command line window.
+
+A complete list of language locales is in [https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes).
+
+Regional subscripts, if required, are listed in  [https://simplelocalize.io/data/locales/](https://simplelocalize.io/data/locales/) .
+
+You should first create a blank language file by executing, for example, `touch gv.po`.
+
+## Updating a translation file or populating a new translation file
+
+To update (or to populate from new) a language file from the current sources, execute for example `./update-translation.sh gv.po`.
+
+Then edit the language file using a suitable tool.
+
+When complete, you should create a pull request on [https://github.com/BestImageViewer/geeqie/pulls](https://github.com/BestImageViewer/geeqie/pulls).
+
+## Which translation tool to use
+
+The program `poedit` is one of the programs suitable for making translations.
+
+## Required program files
+
+`xgettext` and `itstool` are required.
+
+## Other files
+
+The script `gen_translations_stats.sh` generates statistics about translations.
diff --git a/po/regen_potfiles.sh b/po/regen_potfiles.sh
deleted file mode 100755 (executable)
index dcddf44..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-## @file
-## @brief Generate a patch to update POTFILES
-##
-## Use like this: ./regen_potfiles.sh | patch -p0
-##
-
-# TODO(xsdg): Re-write this in a simpler way and test that it works: (cd ..; find ... | sort > $TMP)
-
-TMP=POTFILES.$$
-( (find ../src/ -type f \( -name '*.c' -o -name '*.cc' -o -name "*.ui" \) ; find ../ -type f -name '*.desktop.in' ; find ../ -type f -name '*.appdata.xml.in') | while read -r f; do
-       (echo "$f" | sed 's#^../##')
-done) | sort > "$TMP"
-diff -u POTFILES "$TMP"
-rm -f "$TMP"
diff --git a/po/update-translation.sh b/po/update-translation.sh
new file mode 100755 (executable)
index 0000000..16d07ec
--- /dev/null
@@ -0,0 +1,102 @@
+#!/bin/sh
+#**********************************************************************
+# Copyright (C) 2025 - The Geeqie Team
+#
+# Author: Colin Clark
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#**********************************************************************
+
+## @file
+## @brief Update a language translation file
+## $1 Language file to update
+##
+## Generate LINGUAS file from existing .po files
+## Create a new temporary message.pot file
+## Merge updates into the required language file
+##
+
+if ! command -v xgettext >/dev/null 2>&1
+then
+    echo "Error: xgettext is not installed."
+    exit 1
+fi
+
+if ! command -v itstool >/dev/null 2>&1
+then
+    echo "Error: itstool is not installed."
+    exit 1
+fi
+
+if [ ! -f "./$1" ]; then
+    echo "'$1' is not a file in the current directory."
+    echo "Call by: ./update-translation.sh xx.po"
+    exit 1
+fi
+
+# The LINGUAS file is required by Meson - maybe only for .desktop files
+: > LINGUAS  # Truncate or create the file
+
+for po_file in $(find . -name "*.po" 2>/dev/null | cut -c3- | sort)
+do
+    [ -f "$po_file" ] || continue
+    lang="${po_file%.po}"
+    echo "$lang" >> LINGUAS
+done
+
+# It is not necessary to maintain a messages.pot file
+POT_FILE=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXX")
+
+POT_APPDATA=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXX")
+POT_APPDATA_SORTED=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXX")
+POT_DESKTOPS=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXX")
+POT_DESKTOPS_SORTED=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXX")
+POT_SOURCES=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXX")
+POT_SOURCES_SORTED=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXX")
+
+find ../ -type f -name '*.appdata.xml.in' > "$POT_APPDATA"
+find ../ -type f -name '*.desktop.in' > "$POT_DESKTOPS"
+find ../src -type f -name '*.cc' > "$POT_SOURCES"
+sort "$POT_APPDATA" > "$POT_APPDATA_SORTED"
+sort "$POT_DESKTOPS" > "$POT_DESKTOPS_SORTED"
+sort "$POT_SOURCES" > "$POT_SOURCES_SORTED"
+
+xargs itstool  --output="$POT_FILE" \
+           < "$POT_APPDATA_SORTED"
+
+xargs xgettext --language=Desktop \
+         --from-code=UTF-8 \
+         --keyword=_ \
+         --join-existing \
+         --output="$POT_FILE" \
+          < "$POT_DESKTOPS_SORTED"
+
+xargs xgettext --language=C++ \
+         --from-code=UTF-8 \
+         --keyword=_ \
+         --keyword=N_ \
+         --join-existing \
+         --output="$POT_FILE" \
+          < "$POT_SOURCES_SORTED"
+
+msgmerge --update "$1" "$POT_FILE"
+
+rm "$POT_FILE"
+rm "$POT_APPDATA"
+rm "$POT_APPDATA_SORTED"
+rm "$POT_DESKTOPS"
+rm "$POT_DESKTOPS_SORTED"
+rm "$POT_SOURCES"
+rm "$POT_SOURCES_SORTED"