forked from WeblateOrg/language-data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (47 loc) · 2.97 KB
/
Makefile
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
# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: MIT
all: weblate_language_data/languages.py weblate_language_data/plural_tags.py PLURALS_DIFF.md $(wildcard weblate_language_data/locale/*/LC_MESSAGES/django.po)
weblate_language_data/languages.py: languages.csv aliases.csv cldr.csv extraplurals.csv default_countries.csv population.csv $(wildcard modules/iso-codes/data/iso_*.json) scripts/generate-language-data
./scripts/generate-language-data
PLURALS_DIFF.md: languages.csv cldr.csv gettext.csv l10n-guide.csv translate.csv scripts/list-diff
./scripts/list-diff
pre-commit run --files PLURALS_DIFF.md || true
cldr.csv: modules/cldr-to-gettext-plural-rules/bin/export-plural-rules scripts/export-cldr
./scripts/export-cldr
gettext.csv: modules/gettext/gettext-tools/src/plural-table.c scripts/export-gettext
./scripts/export-gettext
languages-po/cs.po: modules/cldr-json/cldr-json/cldr-localenames-full/main/en/languages.json $(wildcard modules/cldr-json/cldr-json/cldr-localenames-full/main/*/languages.json) scripts/export-languages-po
./scripts/export-languages-po
l10n-guide.csv: modules/l10n-guide/docs/l10n/pluralforms.rst scripts/export-l10n-guide
./scripts/export-l10n-guide
LANG_DATA = $(shell python -c 'from pkg_resources import Requirement, resource_filename; print(resource_filename(Requirement.parse("translate-toolkit"), "translate/lang/data.py"))')
translate.csv: $(LANG_DATA) scripts/export-translate
./scripts/export-translate
weblate_language_data/plural_tags.py: modules/cldr-json/cldr-json/cldr-core/supplemental/plurals.json scripts/export-plural-tags
./scripts/export-plural-tags
aliases.csv: scripts/export-iso-aliases modules/iso-codes/data/iso_639-2.json modules/iso-codes/data/iso_639-3.json
./scripts/export-iso-aliases
@touch $@
population.csv: modules/cldr-json/cldr-json/cldr-core/supplemental/territoryInfo.json scripts/export-cldr-population
./scripts/export-cldr-population
languages.csv: modules/iso-codes/data/iso_639-2.json scripts/export-iso-languages
./scripts/export-iso-languages
@touch $@
weblate_language_data/locale/django.pot: weblate_language_data/languages.py weblate_language_data/plurals.py
xgettext --add-comments=Translators: --msgid-bugs-address=https://github.com/WeblateOrg/language-data/issues/ --from-code=utf-8 --language=python --no-location --package-name="Weblate Language Data" --output=$@.1 weblate_language_data/*.py
cp $@.1 $@.2
./scripts/copy-pot-date $@ $@.2
if cmp $@ $@.2 ; then touch $@ ; else cp $@.1 $@; fi
rm $@.1 $@.2
.SECONDEXPANSION:
weblate_language_data/locale/%/LC_MESSAGES/django.po: weblate_language_data/locale/django.pot $$(wildcard modules/iso-codes/iso_639-3/$$*.po modules/iso-codes/iso_639-2/$$*.po languages-po/$$*.po)
@echo "Update $@"
@ARGS=""; \
for file in modules/iso-codes/iso_639-3/$*.po modules/iso-codes/iso_639-2/$*.po languages-po/$*.po ; do \
if [ -f $$file ] ; then \
ARGS="$$ARGS -C $$file" ; \
fi ; \
done; \
msgmerge $$ARGS --previous -U $@ $<
@touch $@