view client/Makefile @ 5348:45b03e8ca47e extented-report

Toggles in user overview and in details section as well established This commit introduces toggles to change the state for administrative users to be able to receive the DQL Report. For quick access there is the possibility to change via overview. If you want to edit this in the details or if you change the role of the user to a non administrative, there is the possibility to change the flag in a fast way. When the user looses administrative privilege the option is not available and the according flag is set to "false". Aside: Changed user.go to resolve inconsitencies in frontend where the key "reports" was missing due to "omitempty" in marshalling the go objects.
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 21 Jun 2021 16:41:39 +0200
parents bd4370badbf7
children
line wrap: on
line source

# This is free software under MIT license taken from:
# https://github.com/Polyconseil/vue-gettext/blob/master/Makefile
#
# following changes were made due to requirments:
#   * Add additional locales for the app
#   * Add ability to run the translations Makefile with several users on a multi-user system
#   * prevent clean from being called accidently if ´make´ is executed without parameters

# On OSX the PATH variable isn't exported unless "SHELL" is also set, see: http://stackoverflow.com/a/25506676
SHELL = /bin/bash
NODE_BINDIR = ./node_modules/.bin
export PATH := $(NODE_BINDIR):$(PATH)
LOGNAME := $(shell logname)

# adding the name of the user's login name to the template file, so that
# on a multi-user system several users can run this without interference
TEMPLATE_POT := /tmp/template-$(LOGNAME).pot

# Where to write the files generated by this makefile.
OUTPUT_DIR = src

# Available locales for the app.
LOCALES = de_AT en_GB sk_SK hu_HU hr_HR bg_BG ro_RO

# Name of the generated .po files for each available locale.
LOCALE_FILES ?= $(patsubst %,$(OUTPUT_DIR)/locale/%/LC_MESSAGES/app.po,$(LOCALES))

GETTEXT_SOURCES ?= $(shell find $(OUTPUT_DIR) -name '*.html' -o -name '*.js' -o -name '*.vue' 2> /dev/null)

# Makefile Targets
.PHONY: clean makemessages translations all

all:
	@echo choose a target from: clean makemessages translations

clean:
	rm -f $(TEMPLATE_POT) $(OUTPUT_DIR)/locale/translations.json

makemessages: $(TEMPLATE_POT)

translations: $(OUTPUT_DIR)/locale/translations.json

# Create a main .pot template, then generate .po files for each available language.
# Thanx to Systematic: https://github.com/Polyconseil/systematic/blob/866d5a/mk/main.mk#L167-L183
$(TEMPLATE_POT): $(GETTEXT_SOURCES)
# `dir` is a Makefile built-in expansion function which extracts the directory-part of `$@`.
# `$@` is a Makefile automatic variable: the file name of the target of the rule.
# => `mkdir -p /tmp/`
	mkdir -p $(dir $@)
# Extract gettext strings from templates files and create a POT dictionary template.
	gettext-extract --quiet --attribute v-translate --output $@ $(GETTEXT_SOURCES)
# Generate .po files for each available language.
	@for lang in $(LOCALES); do \
		export PO_FILE=$(OUTPUT_DIR)/locale/$$lang/LC_MESSAGES/app.po; \
		mkdir -p $$(dirname $$PO_FILE); \
		if [ -f $$PO_FILE ]; then  \
			echo "msgmerge --update $$PO_FILE $@"; \
			msgmerge --lang=$$lang --update $$PO_FILE $@ || break ;\
		else \
			msginit --no-translator --locale=$$lang --input=$@ --output-file=$$PO_FILE || break ; \
			msgattrib --no-wrap --no-obsolete -o $$PO_FILE $$PO_FILE || break; \
		fi; \
	done;

$(OUTPUT_DIR)/locale/translations.json: $(LOCALE_FILES)
	mkdir -p $(OUTPUT_DIR)
	gettext-compile --output $@ $(LOCALE_FILES)