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: add atlas support for cookiecutter-django-ida - FC-0012 #409

Merged
Merged
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
15 changes: 12 additions & 3 deletions cookiecutter-django-ida/{{cookiecutter.repo_name}}/Makefile
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ lint: ## run Python code linting
pylint --rcfile=pylintrc {{cookiecutter.project_name}} *.py

quality:
tox -e quality
tox -e quality

pii_check: ## check for PII annotations on all Django models
DJANGO_SETTINGS_MODULE={{cookiecutter.project_name}}.settings.test \
@@ -119,8 +119,7 @@ upgrade: ## update the requirements/*.txt files with the latest packages satisfy
mv requirements/test.tmp requirements/test.txt

extract_translations: ## extract strings to be translated, outputting .mo files
python manage.py makemessages -l en -v1 -d django
python manage.py makemessages -l en -v1 -d djangojs
cd {{cookiecutter.project_name}} && i18n_tool extract --no-segment

dummy_translations: ## generate dummy translation (.po) files
cd {{cookiecutter.project_name}} && i18n_tool dummy
@@ -130,8 +129,18 @@ compile_translations: # compile translation files, outputting .po files for each

fake_translations: extract_translations dummy_translations compile_translations ## generate and compile dummy translation files

ifeq ($(OPENEDX_ATLAS_PULL),)
pull_translations: ## pull translations from Transifex
tx pull -af -t --mode reviewed
else
# Experimental: OEP-58 Pulls translations using atlas
pull_translations:
find {{cookiecutter.project_name}}/conf/locale -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \;
atlas pull $(OPENEDX_ATLAS_ARGS) translations/{{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/conf/locale:{{cookiecutter.project_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
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@ edx-auth-backends
edx-django-utils
edx-django-release-util
edx-drf-extensions
edx-i18n-tools
edx-rest-api-client
mysqlclient
openedx-atlas
pytz
Original file line number Diff line number Diff line change
@@ -4,5 +4,4 @@
-r validation.txt # Core, testing, and quality check dependencies

diff-cover # Changeset diff test coverage
edx-i18n-tools # For i18n_tool dummy
django-debug-toolbar # For debugging Django

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me why all non-english languages have been removed here. On the xblock cookiecutter most are commented out but some non-english languages are still in the config. https://github.com/openedx/edx-cookiecutters/blob/master/cookiecutter-xblock/%7B%7Bcookiecutter.repo_name%7D%7D/%7B%7Bcookiecutter.package_name%7D%7D/conf/locale/config.yaml

Copy link
Member

@OmarIthawi OmarIthawi Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point Brian. That requires some clarification to get it right.

@shadinaif did we try to remove the config.yaml file? Will the po-file compile, extract still work fine?

We know that atlas pull doesn't need config.yaml. But what about i18n_tool generate and i18n_tool extract --no-segment would any of those rely on the locales: list that is being modified?

The xblock cookie-cutter doesn't seem to be needing config.yaml though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should remove those in xblock cookiecutter too. These are templates for new packages. They should contain only English (and maybe dummy for tests). If the developer needs more languages to be used outside atlas, then she must add them manually. But the default is that we're using Atlas which needs only English

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

Original file line number Diff line number Diff line change
@@ -2,84 +2,3 @@

locales:
- en # English - Source Language
- am # Amharic
- ar # Arabic
- az # Azerbaijani
- bg_BG # Bulgarian (Bulgaria)
- bn_BD # Bengali (Bangladesh)
- bn_IN # Bengali (India)
- bs # Bosnian
- ca # Catalan
- ca@valencia # Catalan (Valencia)
- cs # Czech
- cy # Welsh
- da # Danish
- de_DE # German (Germany)
- el # Greek
- en # English
- en_GB # English (United Kingdom)
# Don't pull these until we figure out why pages randomly display in these locales,
# when the user's browser is in English and the user is not logged in.
# - en@lolcat # LOLCAT English
# - en@pirate # Pirate English
- es_419 # Spanish (Latin America)
- es_AR # Spanish (Argentina)
- es_EC # Spanish (Ecuador)
- es_ES # Spanish (Spain)
- es_MX # Spanish (Mexico)
- es_PE # Spanish (Peru)
- et_EE # Estonian (Estonia)
- eu_ES # Basque (Spain)
- fa # Persian
- fa_IR # Persian (Iran)
- fi_FI # Finnish (Finland)
- fil # Filipino
- fr # French
- gl # Galician
- gu # Gujarati
- he # Hebrew
- hi # Hindi
- hr # Croatian
- hu # Hungarian
- hy_AM # Armenian (Armenia)
- id # Indonesian
- it_IT # Italian (Italy)
- ja_JP # Japanese (Japan)
- kk_KZ # Kazakh (Kazakhstan)
- km_KH # Khmer (Cambodia)
- kn # Kannada
- ko_KR # Korean (Korea)
- lt_LT # Lithuanian (Lithuania)
- ml # Malayalam
- mn # Mongolian
- mr # Marathi
- ms # Malay
- nb # Norwegian Bokmål
- ne # Nepali
- nl_NL # Dutch (Netherlands)
- or # Oriya
- pl # Polish
- pt_BR # Portuguese (Brazil)
- pt_PT # Portuguese (Portugal)
- ro # Romanian
- ru # Russian
- si # Sinhala
- sk # Slovak
- sl # Slovenian
- sq # Albanian
- sr # Serbian
- ta # Tamil
- te # Telugu
- th # Thai
- tr_TR # Turkish (Turkey)
- uk # Ukranian
- ur # Urdu
- uz # Uzbek
- vi # Vietnamese
- zh_CN # Chinese (China)
- zh_HK # Chinese (Hong Kong)
- zh_TW # Chinese (Taiwan)

# The locales used for fake-accented English, for testing.
dummy_locales:
- eo