# HG changeset patch # User Bernhard Reiter # Date 1546963089 -3600 # Node ID dd9d90cae683a2bb1cda190aee2d5441fd363188 # Parent d4702b0ff15f4726c713d65ab944d4a7a79c2085 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. diff -r d4702b0ff15f -r dd9d90cae683 client/Makefile --- 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)