diff --git a/Makefile b/Makefile index 06a2425..cafc578 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ release: $(MAKE) build $(MAKE) check translations: - @./scripts/update-po.sh -a + @BUILD_DIR=$(BUILD_DIR) ./scripts/update-po.sh -a gtk4: @$(MAKE) $(UI_FILES) $(UI_FILES): diff --git a/extension/po/messages.pot b/extension/po/messages.pot deleted file mode 100644 index a1f3c23..0000000 --- a/extension/po/messages.pot +++ /dev/null @@ -1,117 +0,0 @@ -# translation for the Alphabetical App Grid GNOME Shell Extension. -# Copyright (C) 2023 Stuart Hayhurst -# This file is distributed under the same license as the alphabetical-grid-extension package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: alphabetical-grid-extension\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-11 01:27+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: extension.js:59 -msgid "Privacy Settings Menu Indicator" -msgstr "" - -#: extension.js:74 extension.js:171 -msgid "Privacy Settings" -msgstr "" - -#: extension.js:80 extension.js:184 extension.js:276 -msgid "Location" -msgstr "" - -#: extension.js:81 extension.js:185 extension.js:277 -msgid "Camera" -msgstr "" - -#: extension.js:82 extension.js:186 extension.js:278 -msgid "Microphone" -msgstr "" - -#: extension.js:109 -msgid "Reset settings" -msgstr "" - -#: extension.js:111 -msgid "Reset to defaults" -msgstr "" - -#: extension.js:158 extension.js:164 -msgid "Privacy" -msgstr "" - -#: extension.js:249 -msgid "All disabled" -msgstr "" - -#. Translators: this displays which setting is enabled, e.g. 'Location enabled' -#: extension.js:256 -msgid " enabled" -msgstr "" - -#: prefs.js:124 prefs.js:140 -msgid "Settings" -msgstr "" - -#: ui/gtk3/prefs.ui:33 -msgid "General settings" -msgstr "" - -#. This is a tooltip -#: ui/gtk3/prefs.ui:56 -msgid "Force the icon to move to right side of the status area" -msgstr "" - -#: ui/gtk3/prefs.ui:72 -msgid "Move status icon right" -msgstr "" - -#: ui/gtk3/prefs.ui:126 -msgid "GNOME 43+ settings" -msgstr "" - -#. This is a tooltip -#: ui/gtk3/prefs.ui:149 -msgid "Use the system quick settings area, instead of an indicator" -msgstr "" - -#: ui/gtk3/prefs.ui:165 -msgid "Use quick settings menu" -msgstr "" - -#. This is a tooltip -#: ui/gtk3/prefs.ui:206 -msgid "Group quick settings together, into a menu" -msgstr "" - -#: ui/gtk3/prefs.ui:222 -msgid "Group quick settings" -msgstr "" - -#: ui/gtk3/prefs.ui:279 -msgid "GNOME 44+ settings" -msgstr "" - -#. This is a tooltip -#: ui/gtk3/prefs.ui:302 -msgid "Show the privacy status in the quick settings subtitle" -msgstr "" - -#: ui/gtk3/prefs.ui:318 -msgid "Use quick settings subtitle" -msgstr "" - -#: ui/gtk3/prefs.ui:368 -msgid "" -"Found this useful?\n" -"Consider donating :)" -msgstr "" diff --git a/scripts/update-po.sh b/scripts/update-po.sh index ca9e9f8..5be3790 100755 --- a/scripts/update-po.sh +++ b/scripts/update-po.sh @@ -2,14 +2,14 @@ #This script generates the latest '.po' file(s) from the source #Usage: 'update-po.sh -l ', use '-a' to update all '.po' files -#Create a new translation from 'po/messages.pot' +#Create a new translation from 'build/messages.pot' promptNewTranslation() { if [[ -n "$1" ]]; then echo -n "The translation for '$1' does not exist, do you want to create it? [Y/n] " read -r reply if [[ "$reply" = "Y" ]] || [[ "$reply" = "y" ]]; then - msginit --input=po/messages.pot --locale="$1" --output-file="po/$1.po" + msginit --input="../$BUILD_DIR/messages.pot" --locale="$1" --output-file="po/$1.po" #Add copyright info sed -i "2s/.*/# Copyright (C) $(date +%Y) Stuart Hayhurst/" "po/$1.po" fi @@ -19,16 +19,23 @@ promptNewTranslation() { #Update translation file $1 updateTranslation() { echo -n "Updating '$1': " - msgmerge --previous -U --quiet "$1" po/messages.pot + msgmerge --previous -U --quiet "$1" "../$BUILD_DIR/messages.pot" msgfmt --check --verbose --output-file=/dev/null "$1" } #Change to repository root and exit on failure set -e cd "$( cd "$( dirname "$0" )" && pwd )/.." || exit 1 -cd "extension" || exit 1 -../scripts/update-pot.sh +#Set build directory if missing, and create it +if [[ "$BUILD_DIR" == "" ]]; then + BUILD_DIR="build" +fi +mkdir -p "$BUILD_DIR" + +#Generate pot file and swap to extension source dir +./scripts/update-pot.sh +cd "extension" || exit 1 if [[ "$1" == "-l" ]]; then #Update / create one specific '.po' file #Check if a valid language code was given diff --git a/scripts/update-pot.sh b/scripts/update-pot.sh index f188e1c..cff124b 100755 --- a/scripts/update-pot.sh +++ b/scripts/update-pot.sh @@ -1,22 +1,27 @@ #!/bin/bash -#This script scans the source code for any translatable strings and updates the po/messages.pot file accordingly +#This script scans the source code for any translatable strings and create the build/messages.pot #Change to repository root and exit on failure set -e cd "$( cd "$( dirname "$0" )" && pwd )/.." || exit 1 -cd "extension" || exit 1 + +#Set build directory if missing, and create it +if [[ "$BUILD_DIR" == "" ]]; then + BUILD_DIR="build" +fi +mkdir -p "$BUILD_DIR" #Update the template file with the strings from the source files xgettext --from-code=UTF-8 \ --add-comments=Translators \ --copyright-holder="Stuart Hayhurst" \ --package-name="privacy-menu-extension" \ - --output=po/messages.pot \ - -- *.js ui/*/*.ui + --output="$BUILD_DIR/messages.pot" \ + -- extension/*.js extension/ui/*/*.ui #Replace some lines of the header with our own -sed -i '1s/.*/# translation for the Privacy Quick Settings GNOME Shell Extension./' po/messages.pot -sed -i "2s/.*/# Copyright (C) $(date +%Y) Stuart Hayhurst/" po/messages.pot -sed -i '17s/CHARSET/UTF-8/' po/messages.pot +sed -i '1s/.*/# translation for the Privacy Quick Settings GNOME Shell Extension./' "$BUILD_DIR/messages.pot" +sed -i "2s/.*/# Copyright (C) $(date +%Y) Stuart Hayhurst/" "$BUILD_DIR/messages.pot" +sed -i '17s/CHARSET/UTF-8/' "$BUILD_DIR/messages.pot" echo "Generated translation list"