changeset 1715:dd9d90cae683

client: improve translation process * Add ability to run the translations Makefile with several users on a multi-user system. For this add -$(LOGNAME) to the template.pot file. This leave the behaviour of this file as is, it still can be inspected. And it allows for parallel use of several users.
author Bernhard Reiter <bernhard@intevation.de>
date Tue, 08 Jan 2019 16:58:09 +0100
parents d4702b0ff15f
children 99be34d8f37a
files client/Makefile
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/client/Makefile	Tue Jan 08 16:07:25 2019 +0100
+++ b/client/Makefile	Tue Jan 08 16:58:09 2019 +0100
@@ -15,6 +15,11 @@
 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
@@ -35,15 +40,15 @@
 	@echo choose a target from: clean makemessages translations
 
 clean:
-	rm -f /tmp/template.pot $(OUTPUT_DIR)/locale/translations.json
+	rm -f $(TEMPLATE_POT) $(OUTPUT_DIR)/locale/translations.json
 
-makemessages: /tmp/template.pot
+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
-/tmp/template.pot: $(GETTEXT_HTML_SOURCES)
+$(TEMPLATE_POT): $(GETTEXT_HTML_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/`
@@ -66,6 +71,6 @@
 		msgattrib --no-wrap --no-obsolete -o $$PO_FILE $$PO_FILE; \
 	done;
 
-$(OUTPUT_DIR)/locale/translations.json: clean /tmp/template.pot
+$(OUTPUT_DIR)/locale/translations.json: clean $(TEMPLATE_POT)
 	mkdir -p $(OUTPUT_DIR)
 	gettext-compile --output $@ $(LOCALE_FILES)