Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98364110
Makefile
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jan 12, 12:26
Size
3 KB
Mime Type
text/x-makefile
Expires
Tue, Jan 14, 12:26 (2 d)
Engine
blob
Format
Raw Data
Handle
23569714
Attached To
rEDXLOCALE edx-locale
Makefile
View Options
SHELL := /bin/bash
OS := $(shell uname)
export PATH := /usr/local/opt/gettext/bin:$(PATH)
_LC_PLATFORM := conf/locale-platform
_LC_PATCH := conf/locale-patch
_LC_THEME := conf/locale-theme
_LC_MICROSITE := conf/locale-microsite
_LC_ALL := conf/locale-all
_LC_LANGUAGE_AR := ar/LC_MESSAGES
_LC_LANGUAGE_FR := fr/LC_MESSAGES
_LC_LANGUAGE_DE := de/LC_MESSAGES
define make_dirs
mkdir -p $(_LC_PLATFORM)/$(1) \
$(_LC_PATCH)/$(1) \
$(_LC_THEME)/$(1) \
$(_LC_MICROSITE)/$(1) \
$(_LC_ALL)/$(1)
endef
define tx_pull
source venv/bin/activate && \
tx pull -l $(1) && \
mv .tx/open-edx-releases.release-ironwood/$(1)_translation $(_LC_PLATFORM)/$(2)/django.po
endef
define po_local_exec
source venv/bin/activate && \
pybabel extract --omit-header -F babel-themes.cfg -o $(_LC_THEME)/$(1)/.django.po ../edx-themes && \
pybabel extract --omit-header -F babel-edx-microsite.cfg -o $(_LC_MICROSITE)/$(1)/.django.po ../edx-microsite && \
pybabel extract --omit-header -F babel-patches.cfg -o $(_LC_PATCH)/$(1)/.django.po ../edx-platform-patches/ironwood && \
msgcat $(_LC_THEME)/$(1)/django.po $(_LC_THEME)/$(1)/.django.po -o $(_LC_THEME)/$(1)/tmp.po --use-first && \
msgcat $(_LC_MICROSITE)/$(1)/django.po $(_LC_MICROSITE)/$(1)/.django.po -o $(_LC_MICROSITE)/$(1)/tmp.po --use-first && \
msgcat $(_LC_PATCH)/$(1)/django.po $(_LC_PATCH)/$(1)/.django.po -o $(_LC_PATCH)/$(1)/tmp.po --use-first && \
mv $(_LC_THEME)/$(1)/tmp.po $(_LC_THEME)/$(1)/django.po && \
mv $(_LC_MICROSITE)/$(1)/tmp.po $(_LC_MICROSITE)/$(1)/django.po && \
mv $(_LC_PATCH)/$(1)/tmp.po $(_LC_PATCH)/$(1)/django.po && \
rm $(_LC_THEME)/$(1)/.django.po $(_LC_MICROSITE)/$(1)/.django.po $(_LC_PATCH)/$(1)/.django.po
endef
define mo_exec
source venv/bin/activate && \
msgcat $(_LC_PLATFORM)/$(1)/django.po \
$(_LC_PATCH)/$(1)/django.po \
$(_LC_THEME)/$(1)/django.po \
$(_LC_MICROSITE)/$(1)/django.po \
$(_LC_ALL)/$(1)/manual.po \
--output-file $(_LC_ALL)/$(1)/django.po && \
msgfmt $(_LC_ALL)/$(1)/django.po --output-file $(_LC_ALL)/$(1)/django.mo
endef
# ---- Targets ----
default: help
all: po mo
@echo " ===> Done"
.PHONY: all
init: ## Initialize environment
@echo " ===> Initialize."
$(call make_dirs,$(_LC_LANGUAGE_AR))
$(call make_dirs,$(_LC_LANGUAGE_FR))
$(call make_dirs,$(_LC_LANGUAGE_DE))
@if test -d venv; then \
echo "init has been done early. You can remove directory venv to recreate environment."; \
else \
mkdir -p venv && \
virtualenv venv --system-site-packages && \
source venv/bin/activate && \
pip install -r requirements.txt && \
rm -Rf .tx && \
tx init --user=api --token='1/d4eb01906f12e288e33733b098b3a1b45220e572' --host=www.transifex.com && \
echo '[open-edx-releases.release-ironwood]' >> .tx/config && \
echo 'source_file = <lang>_translation' >> .tx/config && \
echo 'source_lang = en_US' >> .tx/config && \
echo 'type = PO' >> .tx/config; \
fi;
.PHONY: init
po: po_remote po_local ## Make .po from remote and local
@echo " ===> Make .po from remote and local."
.PHONY: po
po_remote: ## Download .po file from ironwood
@echo " ===> Download .po file from ironwood."
$(call tx_pull,ar,$(_LC_LANGUAGE_AR))
$(call tx_pull,fr,$(_LC_LANGUAGE_FR))
$(call tx_pull,de,$(_LC_LANGUAGE_DE))
.PHONY: po_remote
po_local: ## Generate .po files from local repos
@echo " ===> Generate .po files from local repos."
$(call po_local_exec,$(_LC_LANGUAGE_AR))
$(call po_local_exec,$(_LC_LANGUAGE_FR))
$(call po_local_exec,$(_LC_LANGUAGE_DE))
.PHONY: po_local
mo: ## Generate mo files
@echo " ===> Generate mo files."
$(call mo_exec,$(_LC_LANGUAGE_AR))
$(call mo_exec,$(_LC_LANGUAGE_FR))
$(call mo_exec,$(_LC_LANGUAGE_DE))
.PHONY: mo
clean: ## Clean working directories
@echo " ===> Clean working directories."
@rm -Rf .tx venv
.PHONY: clean
help:
@grep -h -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: help
Event Timeline
Log In to Comment