Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update makefile for improved translation flow #1297

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 11 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ PY?=python
TAR?=0

BINDIR=bin
POFILESEXEC=$(BINDIR)/pofiles.py
FRONTENDEXEC=$(BINDIR)/frontend.py

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

ifeq ($(TAR), 0)
POFILES_TAR_ARGS=to_tar
else
POFILES_TAR_ARGS=from_tar
POFILES_TAR_ARGS+=$(TAR)
endif

pysrcdirs = internetnl tests interface checks integration_tests
pysrc = $(shell find ${pysrcdirs} -name \*.py)

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

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

translate_content_to_main:
# Note: you may need to run this a few times to get rid of the access denied errors...
# This retrieves the content from the content repository and merges it with the .po files of this repo.
# The procedure is detailed at: https://github.com/internetstandards/Internet.nl_content/blob/master/.README.md
branch ?= main
update_content:
# This retrieves the content from the content repository and merges it with the .po files of this repo.
# The procedure is detailed at: https://github.com/internetstandards/Internet.nl_content/blob/master/.README.md
rm -rf tmp/locale_files/
rm -f tmp/content_repo.tar.gz
git clone [email protected]:internetstandards/Internet.nl_content/ tmp/locale_files/

# If you need a specific branch people are working on:
# git clone -b news-item_PLIS-meeting_on_IPv6 https://github.com/internetstandards/Internet.nl_content/ tmp/locale_files/

# change dir to tmp to prevent the /tmp dir being mentioned in the resulting tar file.
cd tmp && tar zcvf content_repo.tar.gz locale_files/*
${MAKE} translations_tar TAR=tmp/content_repo.tar.gz
${MAKE} translations
. .venv/bin/activate && ${_env} python3 manage.py compilemessages --ignore=.venv
# Purposefully _not_ deleting things in the tmp dir so it allows inspection after execution.

mkdir -p tmp/locale_files/
git clone -b $(branch) [email protected]:internetstandards/Internet.nl_content/ tmp/locale_files/
${DOCKER_COMPOSE_TOOLS_CMD} run --rm tools bin/update_translations.sh
rm -rf tmp/locale_files

update_padded_macs:
chmod +x $(MACSDIR)/update-macs.sh
Expand Down
5 changes: 5 additions & 0 deletions bin/update_translations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
tar --strip-components=1 -cf tmp/content_repo.tar.gz locale_files/*
python3 bin/pofiles.py from_tar tmp/content_repo.tar.gz

# to_django is performed in Dockerfile
Loading