annotate client/Makefile @ 1456:dadf309eec51

translations: add language Solvak * Add language sk_SK using a manual way.
author Bernhard Reiter <bernhard@intevation.de>
date Mon, 03 Dec 2018 12:28:21 +0100
parents 178f5beeab03
children bf32ef5dfb04
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14 # 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
15 SHELL = /bin/bash
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
16 NODE_BINDIR = ./node_modules/.bin
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
17 export PATH := $(NODE_BINDIR):$(PATH)
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.
1456
dadf309eec51 translations: add language Solvak
Bernhard Reiter <bernhard@intevation.de>
parents: 1401
diff changeset
23 LOCALES = de_AT en_GB sk_SK
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
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
28 GETTEXT_HTML_SOURCES = $(shell find $(OUTPUT_DIR) -name '*.vue' -o -name '*.html' 2> /dev/null)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
29 GETTEXT_JS_SOURCES = $(shell find $(OUTPUT_DIR) -name '*.vue' -o -name '*.js')
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
30
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
31 # Makefile Targets
459
bba166f0326e client: make Makefile more robust.
Bernhard Reiter <bernhard@intevation.de>
parents: 159
diff changeset
32 .PHONY: clean makemessages translations all
bba166f0326e client: make Makefile more robust.
Bernhard Reiter <bernhard@intevation.de>
parents: 159
diff changeset
33
bba166f0326e client: make Makefile more robust.
Bernhard Reiter <bernhard@intevation.de>
parents: 159
diff changeset
34 all:
bba166f0326e client: make Makefile more robust.
Bernhard Reiter <bernhard@intevation.de>
parents: 159
diff changeset
35 @echo choose a target from: clean makemessages translations
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
36
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
37 clean:
1400
7ba1de867c8d client: fix Makefile for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1367
diff changeset
38 rm -f /tmp/template.pot $(OUTPUT_DIR)/locale/translations.json
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
39
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
40 makemessages: /tmp/template.pot
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
41
1400
7ba1de867c8d client: fix Makefile for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1367
diff changeset
42 translations: ./$(OUTPUT_DIR)/locale/translations.json
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
43
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
44 # Create a main .pot template, then generate .po files for each available language.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
45 # Thanx to Systematic: https://github.com/Polyconseil/systematic/blob/866d5a/mk/main.mk#L167-L183
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
46 /tmp/template.pot: $(GETTEXT_HTML_SOURCES)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
47 # `dir` is a Makefile built-in expansion function which extracts the directory-part of `$@`.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
48 # `$@` is a Makefile automatic variable: the file name of the target of the rule.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
49 # => `mkdir -p /tmp/`
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
50 mkdir -p $(dir $@)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
51 which gettext-extract
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
52 # Extract gettext strings from templates files and create a POT dictionary template.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
53 gettext-extract --attribute v-translate --quiet --output $@ $(GETTEXT_HTML_SOURCES)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
54 # Extract gettext strings from JavaScript files.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
55 xgettext --language=JavaScript --keyword=npgettext:1c,2,3 \
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
56 --from-code=utf-8 --join-existing --no-wrap \
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
57 --package-name=$(shell node -e "console.log(require('./package.json').name);") \
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
58 --package-version=$(shell node -e "console.log(require('./package.json').version);") \
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
59 --output $@ $(GETTEXT_JS_SOURCES)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
60 # Generate .po files for each available language.
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
61 @for lang in $(LOCALES); do \
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
62 export PO_FILE=$(OUTPUT_DIR)/locale/$$lang/LC_MESSAGES/app.po; \
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
63 echo "msgmerge --update $$PO_FILE $@"; \
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
64 mkdir -p $$(dirname $$PO_FILE); \
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
65 [ -f $$PO_FILE ] && msgmerge --lang=$$lang --update $$PO_FILE $@ || msginit --no-translator --locale=$$lang --input=$@ --output-file=$$PO_FILE; \
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 msgattrib --no-wrap --no-obsolete -o $$PO_FILE $$PO_FILE; \
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
67 done;
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68
1400
7ba1de867c8d client: fix Makefile for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1367
diff changeset
69 $(OUTPUT_DIR)/locale/translations.json: clean /tmp/template.pot
141
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
70 mkdir -p $(OUTPUT_DIR)
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
71 gettext-compile --output $@ $(LOCALE_FILES)