aboutsummaryrefslogtreecommitdiff
path: root/update-translations.sh
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2024-08-27 15:50:10 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2024-08-27 15:50:10 +0200
commit79853595a8e4adacddaeffd42f8e4cfdf5f9a5c5 (patch)
tree1a1e7ab8a8a4b703f3237d2ed77ed9f60a2d42fd /update-translations.sh
parent4bfbd579171d9194956376c7153f378ff6eb9d4e (diff)
parent1398450b47460ae951f69e410311677cb8fc14a7 (diff)
downloadayatana-settings-79853595a8e4adacddaeffd42f8e4cfdf5f9a5c5.tar.gz
ayatana-settings-79853595a8e4adacddaeffd42f8e4cfdf5f9a5c5.tar.bz2
ayatana-settings-79853595a8e4adacddaeffd42f8e4cfdf5f9a5c5.zip
Merge branch 'pr/full-rewrite'
Attributes GH PR #25: https://github.com/AyatanaIndicators/ayatana-settings/pull/25
Diffstat (limited to 'update-translations.sh')
-rwxr-xr-xupdate-translations.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/update-translations.sh b/update-translations.sh
new file mode 100755
index 0000000..3b8ab1b
--- /dev/null
+++ b/update-translations.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# Copyright (C) 2023 by Robert Tari <robert@tari.in>
+#
+# This package 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; version 3 of the License.
+#
+# This package 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, see <http://www.gnu.org/licenses/>
+
+PROJECT=$(grep -Po "^project *\(\K[^ ]+" "CMakeLists.txt")
+VERSION=$(grep -Po "^project *\(.* +VERSION +\K[0-9]+\.[0-9]+\.[0-9]+" "CMakeLists.txt")
+COPYRIGHT="Ayatana Indicators developers"
+ORGANISATION="AyatanaIndicators"
+xgettext --output="po/$PROJECT.pot" --no-wrap --copyright-holder="$COPYRIGHT" --package-name="$PROJECT" --package-version="$VERSION" --default-domain="$PROJECT" --msgid-bugs-address="https://github.com/$ORGANISATION/$PROJECT/issues" --force-po --language=C --keyword=_ src/*.c
+xgettext --output="po/$PROJECT.pot" --no-wrap --omit-header --join-existing --default-domain="$PROJECT" --language=Glade "data/$PROJECT.ui"
+sed -e "s/_Name=/Name=/" -e "s/_Comment=/Comment=/" "data/$PROJECT.desktop.in" > "data/$PROJECT.desktop.intl"
+xgettext --output="po/$PROJECT.pot" --no-wrap --omit-header --join-existing --default-domain="$PROJECT" --keyword --keyword=Name --keyword=Comment --language=Desktop "data/$PROJECT.desktop.intl"
+rm "data/$PROJECT.desktop.intl"
+sed --in-place "s/\"Content-Type: text\/plain; charset=CHARSET\\\n\"/\"Content-Type: text\/plain; charset=UTF-8\\\n\"/" "po/$PROJECT.pot"
+sed --in-place "s/# SOME DESCRIPTIVE TITLE./# Translation of $PROJECT in LANGUAGE/" "po/$PROJECT.pot"
+sed --in-place "s/# Copyright (C) YEAR /# Copyright (C) $(date +%Y) /" "po/$PROJECT.pot"
+
+CATALOGS=$(find . -name '*.po' | sort)
+
+for CAT in $CATALOGS; do
+ LOCALE=$(basename ${CAT%.*})
+ echo "${LOCALE}" >> "po/LINGUAS"
+ msgmerge --no-fuzzy-matching --update --backup=off "$CAT" "po/$PROJECT.pot"
+done
+
+rm "po/LINGUAS"