Use new gnome-extensions command and implement translations

This commit is contained in:
Romain Vigier
2019-11-25 00:36:03 +01:00
parent 7877f0fc0d
commit f4c55820d7
+47 -14
View File
@@ -1,24 +1,41 @@
UUID = nightthemeswitcher@romainvigier.fr
GSEXT_DIR_LOCAL = $(HOME)/.local/share/gnome-shell/extensions
# Night Theme Switcher Gnome Shell extension
#
# Copyright (C) 2019 Romain Vigier
#
# 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 3 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, see <http s ://www.gnu.org/licenses/>.
VERSION = $(shell grep '"version"' ./src/metadata.json | sed 's/.*\s\([0-9.]*\),/\1/')
COPYRIGHT_YEAR = 2019
AUTHOR_NAME = Romain Vigier
AUTHOR_EMAIL =
NAME = $(shell grep '"name"' ./src/metadata.json | sed 's/\s"name":\s"\(.\+\)",\?/\1/')
UUID = $(shell grep '"uuid"' ./src/metadata.json | sed 's/\s"uuid":\s"\(.\+\)",\?/\1/')
VERSION = $(shell grep '"version"' ./src/metadata.json | sed 's/\s"version":\s\([0-9]\+\),\?/\1/')
.PHONY: build
build: clean
mkdir -p ./build/$(UUID)
cp -r ./src/* ./build/$(UUID)
cp ./LICENSE ./build/$(UUID)
mkdir -p ./build
gnome-extensions pack \
--extra-source=../LICENSE \
--podir=./po/ \
--gettext-domain=$(UUID) \
--out-dir=./build \
./src
.PHONY: install
install: uninstall build
mkdir -p $(GSEXT_DIR_LOCAL)
cp -r ./build/* $(GSEXT_DIR_LOCAL)
.PHONY: zip
zip: build
cd ./build/$(UUID) && zip -r ../$(UUID).$(VERSION).zip .
rm -r ./build/$(UUID)
gnome-extensions install ./build/$(UUID).shell-extension.zip
.PHONY: clean
clean:
@@ -26,4 +43,20 @@ clean:
.PHONY: uninstall
uninstall:
-rm -rf $(GSEXT_DIR_LOCAL)/$(UUID)
-gnome-extensions uninstall $(UUID)
.PHONY: pot
pot:
mkdir -p ./src/po
xgettext \
--from-code=UTF-8 \
--keyword=_ \
--package-name="$(NAME)" \
--package-version="$(VERSION)" \
--output=./src/po/$(UUID).pot \
./src/*.js
sed -i '1,4s/SOME DESCRIPTIVE TITLE./$(NAME)/g' ./src/po/$(UUID).pot
sed -i '1,4s/YEAR/$(COPYRIGHT_YEAR)/' ./src/po/$(UUID).pot
sed -i "1,4s/THE PACKAGE'S COPYRIGHT HOLDER/$(AUTHOR_NAME)/" ./src/po/$(UUID).pot
sed -i "1,4s/FIRST AUTHOR/$(AUTHOR_NAME)/" ./src/po/$(UUID).pot
sed -i "1,4s/EMAIL@ADDRESS/$(AUTHOR_EMAIL)/" ./src/po/$(UUID).pot