🔧 Compile locales
This commit is contained in:
@@ -1,9 +1,13 @@
|
|||||||
SHELL := /bin/bash
|
SHELL := /bin/bash
|
||||||
|
|
||||||
JS_FILES = $(shell find -type f -and \( -name "*.js" \))
|
JS_FILES = $(shell find -type f -and \( -name "*.js" \))
|
||||||
|
UI_FILES = $(shell find -type f -and \( -name "*.ui" \))
|
||||||
RESOURCE_FILES = $(shell find resources -mindepth 2 -type f)
|
RESOURCE_FILES = $(shell find resources -mindepth 2 -type f)
|
||||||
|
|
||||||
.PHONY: zip install uninstall clean
|
LOCALES_PO = $(wildcard po/*.po)
|
||||||
|
LOCALES_MO = $(patsubst po/%.po,locale/%/LC_MESSAGES/burn-my-windows.mo,$(LOCALES_PO))
|
||||||
|
|
||||||
|
.PHONY: zip install uninstall all-po pot clean
|
||||||
|
|
||||||
zip: burn-my-windows@schneegans.github.com.zip
|
zip: burn-my-windows@schneegans.github.com.zip
|
||||||
|
|
||||||
@@ -14,23 +18,31 @@ install: burn-my-windows@schneegans.github.com.zip
|
|||||||
uninstall:
|
uninstall:
|
||||||
gnome-extensions uninstall "burn-my-windows@schneegans.github.com"
|
gnome-extensions uninstall "burn-my-windows@schneegans.github.com"
|
||||||
|
|
||||||
|
all-po: $(LOCALES_PO)
|
||||||
|
|
||||||
|
pot: $(JS_FILES) $(UI_FILES)
|
||||||
|
@echo "Generating 'burn-my-windows.pot'..."
|
||||||
|
@xgettext --from-code=UTF-8 \
|
||||||
|
--add-comments=Translators \
|
||||||
|
--copyright-holder="Simon Schneegans" \
|
||||||
|
--package-name="Burn-My-Windows" \
|
||||||
|
--output=po/burn-my-windows.pot \
|
||||||
|
$(JS_FILES) $(UI_FILES)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf \
|
rm -rf \
|
||||||
burn-my-windows@schneegans.github.com.zip \
|
burn-my-windows@schneegans.github.com.zip \
|
||||||
resources/burn-my-windows.gresource \
|
resources/burn-my-windows.gresource \
|
||||||
resources/burn-my-windows.gresource.xml \
|
resources/burn-my-windows.gresource.xml \
|
||||||
schemas/gschemas.compiled
|
schemas/gschemas.compiled \
|
||||||
|
locale \
|
||||||
burn-my-windows@schneegans.github.com.zip: schemas/gschemas.compiled resources/burn-my-windows.gresource $(JS_FILES)
|
ui/*.ui~ \
|
||||||
@# Check if the VERSION variable was passed and set version to it
|
po/*.po~
|
||||||
@if [[ "$(VERSION)" != "" ]]; then \
|
|
||||||
sed -i "s| \"version\":.*| \"version\": $(VERSION)|g" metadata.json; \
|
|
||||||
fi
|
|
||||||
@# TODO Maybe echo version number of the release that was built, in order to facilitate double-checking before publishing it?
|
|
||||||
|
|
||||||
|
burn-my-windows@schneegans.github.com.zip: schemas/gschemas.compiled resources/burn-my-windows.gresource $(JS_FILES) $(LOCALES_MO)
|
||||||
@echo "Packing zip file..."
|
@echo "Packing zip file..."
|
||||||
@rm --force burn-my-windows@schneegans.github.com.zip
|
@rm --force burn-my-windows@schneegans.github.com.zip
|
||||||
@zip -r burn-my-windows@schneegans.github.com.zip -- *.js src/*.js resources/burn-my-windows.gresource schemas/gschemas.compiled metadata.json LICENSE
|
@zip -r burn-my-windows@schneegans.github.com.zip -- *.js src/*.js resources/burn-my-windows.gresource schemas/gschemas.compiled $(LOCALES_MO) metadata.json LICENSE
|
||||||
|
|
||||||
@#Check if the zip size is too big to be uploaded
|
@#Check if the zip size is too big to be uploaded
|
||||||
@if [[ "$$(stat -c %s burn-my-windows@schneegans.github.com.zip)" -gt 4096000 ]]; then \
|
@if [[ "$$(stat -c %s burn-my-windows@schneegans.github.com.zip)" -gt 4096000 ]]; then \
|
||||||
@@ -49,3 +61,14 @@ resources/burn-my-windows.gresource.xml: $(RESOURCE_FILES)
|
|||||||
schemas/gschemas.compiled: schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml
|
schemas/gschemas.compiled: schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml
|
||||||
@echo "Compiling schemas..."
|
@echo "Compiling schemas..."
|
||||||
@glib-compile-schemas schemas
|
@glib-compile-schemas schemas
|
||||||
|
|
||||||
|
locale/%/LC_MESSAGES/burn-my-windows.mo: po/%.po
|
||||||
|
@echo "Compiling $@"
|
||||||
|
@mkdir -p locale/$*/LC_MESSAGES
|
||||||
|
@msgfmt -c -o $@ $<
|
||||||
|
|
||||||
|
po/%.po:
|
||||||
|
@echo "Updating $@"
|
||||||
|
msgmerge --previous --update $@ po/burn-my-windows.pot
|
||||||
|
@# Output translation progress
|
||||||
|
@msgfmt --check --verbose --output-file=/dev/null $@
|
||||||
Reference in New Issue
Block a user