Skip to content

Commit d624e54

Browse files
committed
Update makefile for improved translation flow
1 parent 098d6b7 commit d624e54

File tree

2 files changed

+16
-27
lines changed

2 files changed

+16
-27
lines changed

Makefile

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ PY?=python
44
TAR?=0
55

66
BINDIR=bin
7-
POFILESEXEC=$(BINDIR)/pofiles.py
87
FRONTENDEXEC=$(BINDIR)/frontend.py
98

109
REMOTEDATADIR=remote_data
@@ -26,13 +25,6 @@ mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
2625
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
2726
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
2827

29-
ifeq ($(TAR), 0)
30-
POFILES_TAR_ARGS=to_tar
31-
else
32-
POFILES_TAR_ARGS=from_tar
33-
POFILES_TAR_ARGS+=$(TAR)
34-
endif
35-
3628
pysrcdirs = internetnl tests interface checks integration_tests
3729
pysrc = $(shell find ${pysrcdirs} -name \*.py)
3830

@@ -45,9 +37,8 @@ help:
4537
@echo 'Makefile for internet.nl'
4638
@echo ''
4739
@echo 'Usage:'
48-
@echo ' make translations combine the translation files to Django PO files'
49-
@echo ' make translations_tar create a tar from the translations'
50-
@echo ' make translations_tar TAR=<tar.gz file> read the tar and update the translations'
40+
@echo ' make update_content update the translation files from content repo.'
41+
@echo ' Optional branch=x to use a specific content repo branch.'
5142
@echo ' make frontend (re)generate CSS and Javascript'
5243
@echo ' make update_padded_macs update padded MAC information'
5344
@echo ' make update_cert_fingerprints update certificate fingerpint information'
@@ -69,25 +60,18 @@ frontend:
6960
. .venv/bin/activate && ${_env} python3 manage.py collectstatic --no-input
7061
. .venv/bin/activate && ${_env} python3 manage.py api_generate_doc
7162

63+
${DOCKER_COMPOSE_TOOLS_CMD} run --rm tools bin/lint.sh ${pysrcdirs}
7264

73-
translate_content_to_main:
74-
# Note: you may need to run this a few times to get rid of the access denied errors...
75-
# This retrieves the content from the content repository and merges it with the .po files of this repo.
76-
# The procedure is detailed at: https://github.com/internetstandards/Internet.nl_content/blob/master/.README.md
65+
branch ?= main
66+
update_content:
67+
# This retrieves the content from the content repository and merges it with the .po files of this repo.
68+
# The procedure is detailed at: https://github.com/internetstandards/Internet.nl_content/blob/master/.README.md
7769
rm -rf tmp/locale_files/
7870
rm -f tmp/content_repo.tar.gz
79-
git clone [email protected]:internetstandards/Internet.nl_content/ tmp/locale_files/
80-
81-
# If you need a specific branch people are working on:
82-
# git clone -b news-item_PLIS-meeting_on_IPv6 https://github.com/internetstandards/Internet.nl_content/ tmp/locale_files/
83-
84-
# change dir to tmp to prevent the /tmp dir being mentioned in the resulting tar file.
85-
cd tmp && tar zcvf content_repo.tar.gz locale_files/*
86-
${MAKE} translations_tar TAR=tmp/content_repo.tar.gz
87-
${MAKE} translations
88-
. .venv/bin/activate && ${_env} python3 manage.py compilemessages --ignore=.venv
89-
# Purposefully _not_ deleting things in the tmp dir so it allows inspection after execution.
90-
71+
mkdir -p tmp/locale_files/
72+
git clone -b $(branch) [email protected]:internetstandards/Internet.nl_content/ tmp/locale_files/
73+
${DOCKER_COMPOSE_TOOLS_CMD} run --rm tools bin/update_translations.sh
74+
rm -rf tmp/locale_files
9175

9276
update_padded_macs:
9377
chmod +x $(MACSDIR)/update-macs.sh

bin/update_translations.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
tar --strip-components=1 -cf tmp/content_repo.tar.gz locale_files/*
3+
python3 bin/pofiles.py from_tar tmp/content_repo.tar.gz
4+
5+
# to_django is performed in Dockerfile

0 commit comments

Comments
 (0)