Revise gresources use
[geeqie.git] / scripts / translators.sh
similarity index 60%
rename from src/credits/translators.sh
rename to scripts/translators.sh
index 2e9a253..c9d625d 100755 (executable)
 #**********************************************************************
 
 ## @file
-## @brief Generate a list of people who have contributed translations.
+## @brief Generate lists of people who have made commits to the repository.
 ##
-## This list will be displayed in the About - Credits dialog.
+## The lists will be displayed in the About - Credits dialog.
 ##
-## It is expected that the .po files have a list of translators preceded
-## by the line "# Translators:" and terminated by a line containing only "#"
+## $1 Meson PRIVATE_DIR \n
+## $2 po source list \n
+## $3 Meson current_build_dir \n
+## $4 locales.txt \n
+## $5 gresource.xml \n
 ##
+## It is expected that the .po files have a list of translators in the form: \n
+## \# Translators: \n
+## \# translator1_name <translator1 email> \n
+## \# translator2_name <translator2 email> \n
+## \#
 
-for file in "$1"/po/*.po
+mkdir -p "$1"
+
+printf %s "$2" | while read -r file
 do
        base=$(basename "$file")
        locale=${base%.po}
-       awk '$1 == "'"$locale"'" {print $0}' locales.txt
-       awk '$2 ~/Translators:/ {
+
+       printf "\n"
+       awk '$1 == "'"$locale"'" {print $0}' "$4"
+       awk '$0 ~/Translators:/ {
                while (1) {
                        getline $0
                if ($0 == "#") {
                        exit
                        }
                else {
-                       print substr($0, 3)
+                       print $0
                        }
                }
-
                print $0
        }' "$file"
 
-       printf "\n"
-done > "$2"/translators
-printf "\n\0" >> "$2"/translators
+done > "$1"/translators
+printf "\n\0" >> "$1"/translators
+
+glib-compile-resources --generate-header --sourcedir="$1" --target="$3"/translators.h "$5"
+glib-compile-resources --generate-source --sourcedir="$1" --target="$3"/translators.c "$5"