Mercurial > gemma
annotate client/Makefile @ 1746:09f51f2b3b0d
Cosmetics.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 10 Jan 2019 14:27:03 +0100 |
parents | dd9d90cae683 |
children | 2c71012fee5e |
rev | line source |
---|---|
1401
178f5beeab03
client: (minor) fix header formatting
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1400
diff
changeset
|
1 # This is Free Software under GNU Affero General Public License v >= 3.0 |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
459
diff
changeset
|
2 # without warranty, see README.md and license for details. |
1367
5d4bfe4fa13c
client: improve header infos (minor)
Bernhard Reiter <bernhard@intevation.de>
parents:
1361
diff
changeset
|
3 # |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
459
diff
changeset
|
4 # SPDX-License-Identifier: AGPL-3.0-or-later |
1401
178f5beeab03
client: (minor) fix header formatting
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1400
diff
changeset
|
5 # License-Filename: LICENSES/AGPL-3.0.txt |
1367
5d4bfe4fa13c
client: improve header infos (minor)
Bernhard Reiter <bernhard@intevation.de>
parents:
1361
diff
changeset
|
6 # |
1401
178f5beeab03
client: (minor) fix header formatting
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1400
diff
changeset
|
7 # Copyright (C) 2018 by via donau |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
459
diff
changeset
|
8 # – Österreichische Wasserstraßen-Gesellschaft mbH |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
459
diff
changeset
|
9 # Software engineering by Intevation GmbH |
1367
5d4bfe4fa13c
client: improve header infos (minor)
Bernhard Reiter <bernhard@intevation.de>
parents:
1361
diff
changeset
|
10 # |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
459
diff
changeset
|
11 # Author(s): |
1367
5d4bfe4fa13c
client: improve header infos (minor)
Bernhard Reiter <bernhard@intevation.de>
parents:
1361
diff
changeset
|
12 # * Thomas Junk <thomas.junk@intevation.de> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
459
diff
changeset
|
13 |
141 | 14 # On OSX the PATH variable isn't exported unless "SHELL" is also set, see: http://stackoverflow.com/a/25506676 |
15 SHELL = /bin/bash | |
16 NODE_BINDIR = ./node_modules/.bin | |
17 export PATH := $(NODE_BINDIR):$(PATH) | |
1715
dd9d90cae683
client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents:
1506
diff
changeset
|
18 LOGNAME := $(shell logname) |
dd9d90cae683
client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents:
1506
diff
changeset
|
19 |
dd9d90cae683
client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents:
1506
diff
changeset
|
20 # 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
|
21 # 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
|
22 TEMPLATE_POT := /tmp/template-$(LOGNAME).pot |
141 | 23 |
24 # Where to write the files generated by this makefile. | |
25 OUTPUT_DIR = src | |
26 | |
27 # Available locales for the app. | |
1506
bf32ef5dfb04
Translation: add aditional languages for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1456
diff
changeset
|
28 LOCALES = de_AT en_GB sk_SK hu_HU hr_HR bg_BG ro_RO |
141 | 29 |
30 # Name of the generated .po files for each available locale. | |
31 LOCALE_FILES ?= $(patsubst %,$(OUTPUT_DIR)/locale/%/LC_MESSAGES/app.po,$(LOCALES)) | |
32 | |
33 GETTEXT_HTML_SOURCES = $(shell find $(OUTPUT_DIR) -name '*.vue' -o -name '*.html' 2> /dev/null) | |
34 GETTEXT_JS_SOURCES = $(shell find $(OUTPUT_DIR) -name '*.vue' -o -name '*.js') | |
35 | |
36 # Makefile Targets | |
459
bba166f0326e
client: make Makefile more robust.
Bernhard Reiter <bernhard@intevation.de>
parents:
159
diff
changeset
|
37 .PHONY: clean makemessages translations all |
bba166f0326e
client: make Makefile more robust.
Bernhard Reiter <bernhard@intevation.de>
parents:
159
diff
changeset
|
38 |
bba166f0326e
client: make Makefile more robust.
Bernhard Reiter <bernhard@intevation.de>
parents:
159
diff
changeset
|
39 all: |
bba166f0326e
client: make Makefile more robust.
Bernhard Reiter <bernhard@intevation.de>
parents:
159
diff
changeset
|
40 @echo choose a target from: clean makemessages translations |
141 | 41 |
42 clean: | |
1715
dd9d90cae683
client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents:
1506
diff
changeset
|
43 rm -f $(TEMPLATE_POT) $(OUTPUT_DIR)/locale/translations.json |
141 | 44 |
1715
dd9d90cae683
client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents:
1506
diff
changeset
|
45 makemessages: $(TEMPLATE_POT) |
141 | 46 |
1400
7ba1de867c8d
client: fix Makefile for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1367
diff
changeset
|
47 translations: ./$(OUTPUT_DIR)/locale/translations.json |
141 | 48 |
49 # Create a main .pot template, then generate .po files for each available language. | |
50 # Thanx to Systematic: https://github.com/Polyconseil/systematic/blob/866d5a/mk/main.mk#L167-L183 | |
1715
dd9d90cae683
client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents:
1506
diff
changeset
|
51 $(TEMPLATE_POT): $(GETTEXT_HTML_SOURCES) |
141 | 52 # `dir` is a Makefile built-in expansion function which extracts the directory-part of `$@`. |
53 # `$@` is a Makefile automatic variable: the file name of the target of the rule. | |
54 # => `mkdir -p /tmp/` | |
55 mkdir -p $(dir $@) | |
56 which gettext-extract | |
57 # Extract gettext strings from templates files and create a POT dictionary template. | |
58 gettext-extract --attribute v-translate --quiet --output $@ $(GETTEXT_HTML_SOURCES) | |
59 # Extract gettext strings from JavaScript files. | |
60 xgettext --language=JavaScript --keyword=npgettext:1c,2,3 \ | |
61 --from-code=utf-8 --join-existing --no-wrap \ | |
62 --package-name=$(shell node -e "console.log(require('./package.json').name);") \ | |
63 --package-version=$(shell node -e "console.log(require('./package.json').version);") \ | |
64 --output $@ $(GETTEXT_JS_SOURCES) | |
65 # Generate .po files for each available language. | |
66 @for lang in $(LOCALES); do \ | |
67 export PO_FILE=$(OUTPUT_DIR)/locale/$$lang/LC_MESSAGES/app.po; \ | |
68 echo "msgmerge --update $$PO_FILE $@"; \ | |
69 mkdir -p $$(dirname $$PO_FILE); \ | |
70 [ -f $$PO_FILE ] && msgmerge --lang=$$lang --update $$PO_FILE $@ || msginit --no-translator --locale=$$lang --input=$@ --output-file=$$PO_FILE; \ | |
71 msgattrib --no-wrap --no-obsolete -o $$PO_FILE $$PO_FILE; \ | |
72 done; | |
73 | |
1715
dd9d90cae683
client: improve translation process
Bernhard Reiter <bernhard@intevation.de>
parents:
1506
diff
changeset
|
74 $(OUTPUT_DIR)/locale/translations.json: clean $(TEMPLATE_POT) |
141 | 75 mkdir -p $(OUTPUT_DIR) |
76 gettext-compile --output $@ $(LOCALE_FILES) |