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

feat: FC-0012 - add atlas support for cookiecutter-django-app #392

Merged
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
19 changes: 14 additions & 5 deletions cookiecutter-django-app/{{cookiecutter.repo_name}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,26 @@ selfcheck: ## check that the Makefile is well-formed

extract_translations: ## extract strings to be translated, outputting .mo files
rm -rf docs/_build
cd {{cookiecutter.app_name}} && ../manage.py makemessages -l en -v1 -d django
cd {{cookiecutter.app_name}} && ../manage.py makemessages -l en -v1 -d djangojs
cd {{cookiecutter.app_name}} && i18n_tool extract --no-segment

compile_translations: ## compile translation files, outputting .po files for each supported language
cd {{cookiecutter.app_name}} && ../manage.py compilemessages
cd {{cookiecutter.app_name}} && i18n_tool generate

detect_changed_source_translations:
shadinaif marked this conversation as resolved.
Show resolved Hide resolved
cd {{cookiecutter.app_name}} && i18n_tool changed

pull_translations: ## pull translations from Transifex
tx pull -af -t --mode reviewed
ifeq ($(OPENEDX_ATLAS_PULL),)
pull_translations: ## Pull translations from Transifex
tx pull -t -a -f --mode reviewed --minimum-perc=1
else
# Experimental: OEP-58 Pulls translations using atlas
pull_translations:
find {{cookiecutter.app_name}}/conf/locale -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \;
atlas pull $(OPENEDX_ATLAS_ARGS) translations/{{cookiecutter.repo_name}}/{{cookiecutter.app_name}}/conf/locale:{{cookiecutter.app_name}}/conf/locale
python manage.py compilemessages

@echo "Translations have been pulled via Atlas and compiled."
endif

push_translations: ## push source translation files (.po) from Transifex
tx push -s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ Django # Web application framework
{% if cookiecutter.models != "Comma-separated list of models" -%}
django-model-utils # Provides TimeStampedModel abstract base class
{%- endif %}

openedx-atlas
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{% raw %}

{% load i18n %}
{% trans "Dummy text to generate a translation (.po) source file. It is safe to delete this line. It is also safe to delete (load i18n) above if there are no other (trans) tags in the file" %}

{% comment %}
As the developer of this package, don't place anything here if you can help it
since this allows developers to have interoperability between your template
Expand Down