forked from LinOTP/LinOTP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.linotp
More file actions
85 lines (75 loc) · 2.6 KB
/
Makefile.linotp
File metadata and controls
85 lines (75 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# -*- coding: utf-8 -*-
#
# LinOTP - the open source solution for two factor authentication
# Copyright (C) 2010-2019 KeyIdentity GmbH
# Copyright (C) 2019- netgo software GmbH
#
# This file is part of LinOTP server.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public
# License, version 3, as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the
# GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# E-mail: info@linotp.de
# Contact: www.linotp.org
# Support: www.linotp.de
#
PYTHON:=$(shell which python3)
PROJECT=LinOTP
LINOTP_SRC_VERSION=$(shell python3 -c "import linotp; print(linotp.__version__)")
I18N_LANGUAGES = de
I18N_SRC := $(CURDIR)/linotp/i18n
I18N_JSON_DEST := $(CURDIR)/linotp/public/i18n
I18N_PO_FILES := $(foreach lang,$(I18N_LANGUAGES),$(I18N_SRC)/$(lang)/LC_MESSAGES/linotp.po)
I18N_JSON_FILES := $(foreach lang,$(I18N_LANGUAGES),$(I18N_JSON_DEST)/$(lang).json)
.PHONY: extract
extract:
pybabel extract \
--mapping-file=babel.cfg \
--output-file=$(I18N_SRC)/linotp.pot \
--msgid-bugs-address=info@linotp.de \
--copyright-holder="netgo software GmbH" \
--no-location \
linotp
$(foreach lang, \
$(I18N_LANGUAGES), \
msgmerge -U -s $(I18N_SRC)/$(lang)/LC_MESSAGES/linotp.po $(I18N_SRC)/linotp.pot \
;\
)
$(I18N_SRC)/%/LC_MESSAGES/linotp.po: extract
.PHONY: translate
translate:
@echo "Execute translate-LANG (e.g. translate-de)"
translate-%: $(I18N_SRC)/%/LC_MESSAGES/linotp.po
gtranslator $<
$(MAKE) -f Makefile.linotp compile_catalog
check_pojson:
pojson --help > /dev/null 2>&1 || { \
echo "pojson is not installed. Installing..."; \
uv pip install pojson; \
}
# Compile a .po file to a .json file using the `pojson` tool.
$(I18N_JSON_DEST)/%.json: $(I18N_SRC)/%/LC_MESSAGES/linotp.po check_pojson
mkdir -p $(I18N_JSON_DEST)
pojson -p -e utf-8 $< > $@
# Compile all .po files to .mo files using babel. As a dependency,
# the .po files are compiled to .json files. The order doesn't matter.
.PHONY: compile_catalog
compile_catalog: $(I18N_JSON_FILES)
pybabel compile \
--domain=linotp \
--directory=$(I18N_SRC) \
--use-fuzzy \
--statistics
.PHONY: buildtranslation
buildtranslation: extract compile_catalog