annotate client/Makefile @ 5560:f2204f91d286

Join the log lines of imports to the log exports to recover data from them. Used in SR export to extract information that where in the meta json but now are only found in the log.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 09 Feb 2022 18:34:40 +0100
parents bd4370badbf7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1792
2c71012fee5e correct Makefile attribution header
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1715
diff changeset
1 # This is free software under MIT license taken from:
2c71012fee5e correct Makefile attribution header
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1715
diff changeset
2 # https://github.com/Polyconseil/vue-gettext/blob/master/Makefile
1367
5d4bfe4fa13c client: improve header infos (minor)
Bernhard Reiter <bernhard@intevation.de>
parents: 1361
diff changeset
3 #
1792
2c71012fee5e correct Makefile attribution header
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1715
diff changeset
4 # following changes were made due to requirments:
2c71012fee5e correct Makefile attribution header
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1715
diff changeset
5 # * Add additional locales for the app
2c71012fee5e correct Makefile attribution header
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1715
diff changeset
6 # * Add ability to run the translations Makefile with several users on a multi-user system
2c71012fee5e correct Makefile attribution header
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1715
diff changeset
7 # * prevent clean from being called accidently if ´make´ is executed without parameters
1361
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 459
diff changeset
8
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 # On OSX the PATH variable isn't exported unless "SHELL" is also set, see: http://stackoverflow.com/a/25506676
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 SHELL = /bin/bash
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 NODE_BINDIR = ./node_modules/.bin
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
12 export PATH := $(NODE_BINDIR):$(PATH)
1715
dd9d90cae683 client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents: 1506
diff changeset
13 LOGNAME := $(shell logname)
dd9d90cae683 client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents: 1506
diff changeset
14
dd9d90cae683 client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents: 1506
diff changeset
15 # adding the name of the user's login name to the template file, so that
dd9d90cae683 client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents: 1506
diff changeset
16 # on a multi-user system several users can run this without interference
dd9d90cae683 client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents: 1506
diff changeset
17 TEMPLATE_POT := /tmp/template-$(LOGNAME).pot
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
19 # Where to write the files generated by this makefile.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20 OUTPUT_DIR = src
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
21
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
22 # Available locales for the app.
1506
bf32ef5dfb04 Translation: add aditional languages for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1456
diff changeset
23 LOCALES = de_AT en_GB sk_SK hu_HU hr_HR bg_BG ro_RO
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
24
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
25 # Name of the generated .po files for each available locale.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
26 LOCALE_FILES ?= $(patsubst %,$(OUTPUT_DIR)/locale/%/LC_MESSAGES/app.po,$(LOCALES))
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
27
2013
a1164d2e23e1 client: translations: get improvments on Makefile from upstream
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1850
diff changeset
28 GETTEXT_SOURCES ?= $(shell find $(OUTPUT_DIR) -name '*.html' -o -name '*.js' -o -name '*.vue' 2> /dev/null)
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
29
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
30 # Makefile Targets
459
bba166f0326e client: make Makefile more robust.
Bernhard Reiter <bernhard@intevation.de>
parents: 159
diff changeset
31 .PHONY: clean makemessages translations all
bba166f0326e client: make Makefile more robust.
Bernhard Reiter <bernhard@intevation.de>
parents: 159
diff changeset
32
bba166f0326e client: make Makefile more robust.
Bernhard Reiter <bernhard@intevation.de>
parents: 159
diff changeset
33 all:
bba166f0326e client: make Makefile more robust.
Bernhard Reiter <bernhard@intevation.de>
parents: 159
diff changeset
34 @echo choose a target from: clean makemessages translations
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
35
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
36 clean:
1715
dd9d90cae683 client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents: 1506
diff changeset
37 rm -f $(TEMPLATE_POT) $(OUTPUT_DIR)/locale/translations.json
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
38
1715
dd9d90cae683 client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents: 1506
diff changeset
39 makemessages: $(TEMPLATE_POT)
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
40
1850
6840401ec6a6 client: translations: (minor) improve Makefile
Bernhard Reiter <bernhard@intevation.de>
parents: 1849
diff changeset
41 translations: $(OUTPUT_DIR)/locale/translations.json
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
42
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
43 # Create a main .pot template, then generate .po files for each available language.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
44 # Thanx to Systematic: https://github.com/Polyconseil/systematic/blob/866d5a/mk/main.mk#L167-L183
2013
a1164d2e23e1 client: translations: get improvments on Makefile from upstream
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1850
diff changeset
45 $(TEMPLATE_POT): $(GETTEXT_SOURCES)
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
46 # `dir` is a Makefile built-in expansion function which extracts the directory-part of `$@`.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
47 # `$@` is a Makefile automatic variable: the file name of the target of the rule.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
48 # => `mkdir -p /tmp/`
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
49 mkdir -p $(dir $@)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
50 # Extract gettext strings from templates files and create a POT dictionary template.
2013
a1164d2e23e1 client: translations: get improvments on Makefile from upstream
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1850
diff changeset
51 gettext-extract --quiet --attribute v-translate --output $@ $(GETTEXT_SOURCES)
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
52 # Generate .po files for each available language.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
53 @for lang in $(LOCALES); do \
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
54 export PO_FILE=$(OUTPUT_DIR)/locale/$$lang/LC_MESSAGES/app.po; \
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
55 mkdir -p $$(dirname $$PO_FILE); \
2121
bd4370badbf7 Improve Makefile target `makemessages`
Bernhard Reiter <bernhard@intevation.de>
parents: 2013
diff changeset
56 if [ -f $$PO_FILE ]; then \
bd4370badbf7 Improve Makefile target `makemessages`
Bernhard Reiter <bernhard@intevation.de>
parents: 2013
diff changeset
57 echo "msgmerge --update $$PO_FILE $@"; \
bd4370badbf7 Improve Makefile target `makemessages`
Bernhard Reiter <bernhard@intevation.de>
parents: 2013
diff changeset
58 msgmerge --lang=$$lang --update $$PO_FILE $@ || break ;\
bd4370badbf7 Improve Makefile target `makemessages`
Bernhard Reiter <bernhard@intevation.de>
parents: 2013
diff changeset
59 else \
bd4370badbf7 Improve Makefile target `makemessages`
Bernhard Reiter <bernhard@intevation.de>
parents: 2013
diff changeset
60 msginit --no-translator --locale=$$lang --input=$@ --output-file=$$PO_FILE || break ; \
bd4370badbf7 Improve Makefile target `makemessages`
Bernhard Reiter <bernhard@intevation.de>
parents: 2013
diff changeset
61 msgattrib --no-wrap --no-obsolete -o $$PO_FILE $$PO_FILE || break; \
bd4370badbf7 Improve Makefile target `makemessages`
Bernhard Reiter <bernhard@intevation.de>
parents: 2013
diff changeset
62 fi; \
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
63 done;
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
64
1849
aabde3279947 client: translations: improve Makefile
Bernhard Reiter <bernhard@intevation.de>
parents: 1792
diff changeset
65 $(OUTPUT_DIR)/locale/translations.json: $(LOCALE_FILES)
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 mkdir -p $(OUTPUT_DIR)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
67 gettext-compile --output $@ $(LOCALE_FILES)