From 2d103ed4546c79d7d4b5233a4bebf93809920674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Fri, 22 Oct 2021 22:23:59 +0200 Subject: Fix the file save dialog and translations --- po/make-template.sh | 49 +++++++++++++++++-------------------------------- 1 file changed, 17 insertions(+), 32 deletions(-) (limited to 'po/make-template.sh') diff --git a/po/make-template.sh b/po/make-template.sh index d86ea81..67b3295 100755 --- a/po/make-template.sh +++ b/po/make-template.sh @@ -1,36 +1,21 @@ -#!/bin/bash -# This script makes a translation template -# The reason for this not being inside CMakeLists.txt -# is that the translator should not need to run -# the whole configure process to get this single stupid file. +#!/bin/sh -e +# This shell script generates the translation template. +# +# The reason for this not being inside CMakeLists.txt is that the translator +# should not need to run the whole configuration process just to get this file. +dir=$(dirname $0) -# Source files -SOURCES=$(echo ../{src,liblogdiag}/*.c) +export LC_ALL=C -# Get the package name from CMakeLists.txt -PACKAGE=$(sed -n '/^[ \t]*[pP][rR][oO][jJ][eE][cC][tT][ \t]*([ \t]*\([^ \t)]\{1,\}\).*).*/{s//\1/p;q}' \ - ../CMakeLists.txt) - -# Get the package version from CMakeLists.txt -EXP_BEG='/^[ \t]*[sS][eE][tT][ \t]*([ \t]*project_VERSION_' -EXP_END='[ \t]\{1,\}"\{0,1\}\([^)"]\{1,\}\)"\{0,1\}).*/{s//\1/p;q}' - -MAJOR=$(sed -n "${EXP_BEG}MAJOR${EXP_END}" ../CMakeLists.txt) -MINOR=$(sed -n "${EXP_BEG}MINOR${EXP_END}" ../CMakeLists.txt) -PATCH=$(sed -n "${EXP_BEG}PATCH${EXP_END}" ../CMakeLists.txt) - -if [ "$MAJOR" != "" ]; then - VERSION=$MAJOR - if [ "$MINOR" != "" ]; then - VERSION=$VERSION.$MINOR - if [ "$PATCH" != "" ]; then - VERSION=$VERSION.$PATCH - fi - fi +re='^[ \t]*project *( *\([^ \t)]\{1,\}\) \{1,\}VERSION \{1,\}\([^ \t)]\{1,\}\).*' +package=$(sed -n "s/$re/\\1/p" "$dir/../CMakeLists.txt") +version=$(sed -n "s/$re/\\2/p" "$dir/../CMakeLists.txt") +if [ -z "$package" -o -z "$version" ]; then + echo "Failed to get information from CMakeLists.txt" + exit 1 fi -# Finally make the template -xgettext -LC -k_ -kN_ $SOURCES -o "$PACKAGE".pot \ - --package-name="$PACKAGE" --package-version="$VERSION" \ - --copyright-holder="Přemysl Eric Janouch" - +xgettext -LC -k_ -kN_ "$dir"/../{src,liblogdiag}/*.c -o "$dir/$package.pot" \ + --package-name="$package" --package-version="$version" \ + --copyright-holder="Přemysl Eric Janouch" \ + --msgid-bugs-address="https://git.janouch.name/p/$package/issues" -- cgit v1.2.3