forked from toolshed/abra
33
Makefile
33
Makefile
@ -6,6 +6,10 @@ GOVERSION := 1.24
|
||||
LDFLAGS := "-X 'main.Commit=$(COMMIT)'"
|
||||
DIST_LDFLAGS := $(LDFLAGS)" -s -w"
|
||||
GCFLAGS := "all=-l -B"
|
||||
DOMAIN := abra
|
||||
POFILES := $(wildcard pkg/i18n/locales/*.po)
|
||||
MOFILES := $(patsubst %.po,%.mo,$(POFILES))
|
||||
LINGUAS := $(basename $(POFILES))
|
||||
|
||||
export GOPRIVATE=coopcloud.tech
|
||||
|
||||
@ -59,3 +63,32 @@ loc:
|
||||
|
||||
deps:
|
||||
@go get -t -u ./...
|
||||
|
||||
.PHONY: i18n
|
||||
i18n: update-pot update-pot-po-metadata update-po build-mo
|
||||
|
||||
.PHONY: update-po
|
||||
update-po:
|
||||
@set -eu; \
|
||||
for lang in $(LINGUAS); do \
|
||||
msgmerge --backup=none -U $$lang.po pkg/i18n/locales/$(DOMAIN).pot; \
|
||||
done
|
||||
|
||||
.PHONY: update-pot
|
||||
update-pot:
|
||||
@xgettext-go \
|
||||
-o pkg/i18n/locales/$(DOMAIN).pot \
|
||||
--keyword=i18n.G \
|
||||
--sort-output \
|
||||
$$(find . -name "*.go" -not -path "*vendor*")
|
||||
|
||||
.PHONY: update-pot-po-metadata
|
||||
update-pot-po-metadata:
|
||||
@sed -i "s/charset=CHARSET/charset=UTF-8/g" pkg/i18n/locales/*.po*
|
||||
|
||||
.PHONY: build-mo
|
||||
build-mo:
|
||||
@set -eu; \
|
||||
for lang in $(POFILES); do \
|
||||
msgfmt $$lang -o $$(echo $$lang | sed 's/.po/.mo/g') --statistics; \
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user