Skip to content

Commit

Permalink
feat: stardandize XBlock template to support atlas
Browse files Browse the repository at this point in the history
Refs: FC-0012 OEP-58
  • Loading branch information
shadinaif committed Aug 21, 2023
1 parent a0c0dde commit e11f8f6
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 11 deletions.
10 changes: 2 additions & 8 deletions cookiecutter-xblock/{{cookiecutter.repo_name}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

REPO_NAME := {{cookiecutter.repo_name}}
PACKAGE_NAME := {{cookiecutter.package_name}}
EXTRACT_DIR := $(PACKAGE_NAME)/locale/en/LC_MESSAGES
EXTRACTED_DJANGO := $(EXTRACT_DIR)/django-partial.po
EXTRACTED_DJANGOJS := $(EXTRACT_DIR)/djangojs-partial.po
EXTRACTED_TEXT := $(EXTRACT_DIR)/text.po
JS_TARGET := public/js/translations
TRANSLATIONS_DIR := $(PACKAGE_NAME)/translations

Expand Down Expand Up @@ -58,9 +54,7 @@ dev.run: dev.clean dev.build ## Clean, build and run test image
## Localization targets

extract_translations: symlink_translations ## extract strings to be translated, outputting .po files
cd $(PACKAGE_NAME) && i18n_tool extract
mv $(EXTRACTED_DJANGO) $(EXTRACTED_TEXT)
if [ -f "$(EXTRACTED_DJANGOJS)" ]; then cat $(EXTRACTED_DJANGOJS) >> $(EXTRACTED_TEXT); rm $(EXTRACTED_DJANGOJS); fi
cd $(PACKAGE_NAME) && i18n_tool extract --merge-js --combine-partial

compile_translations: symlink_translations ## compile translation files, outputting .mo files for each supported language
cd $(PACKAGE_NAME) && i18n_tool generate
Expand All @@ -83,7 +77,7 @@ push_translations: extract_translations ## push translations to transifex
cd $(PACKAGE_NAME) && i18n_tool transifex push

symlink_translations:
if [ ! -d "$(TRANSLATIONS_DIR)" ]; then ln -s locale/ $(TRANSLATIONS_DIR); fi
if [ ! -d "$(TRANSLATIONS_DIR)" ]; then ln -s conf/locale/ $(TRANSLATIONS_DIR); fi

install_transifex_client: ## Install the Transifex client
# Instaling client will skip CHANGELOG and LICENSE files from git changes
Expand Down
2 changes: 1 addition & 1 deletion cookiecutter-xblock/{{cookiecutter.repo_name}}/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ These catalogs can be created by running::
$ make extract_translations

The previous command will create the necessary ``.po`` files under
``{{cookiecutter.repo_name}}/{{cookiecutter.package_name}}/locale/en/LC_MESSAGES/text.po``.
``{{cookiecutter.repo_name}}/{{cookiecutter.package_name}}/conf/locale/en/LC_MESSAGES/text.po``.
The ``text.po`` file is created from the ``django-partial.po`` file created by
``django-admin makemessages`` (`makemessages documentation <https://docs.djangoproject.com/en/3.2/topics/i18n/translation/#message-files>`_),
this is why you will not see a ``django-partial.po`` file.
Expand Down
2 changes: 1 addition & 1 deletion cookiecutter-xblock/{{cookiecutter.repo_name}}/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
if __name__ == "__main__":
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE",
"{{cookiecutter.package_name}}.locale.settings"
"{{cookiecutter.package_name}}.conf.locale.settings"
)

execute_from_command_line(sys.argv)
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

STATICI18N_DOMAIN = 'text'
STATICI18N_PACKAGES = (
'{{cookiecutter.package_name}}.translations',
'{{cookiecutter.package_name}}',
)
STATICI18N_ROOT = '{{cookiecutter.package_name}}/public/js'
STATICI18N_OUTPUT_DIR = 'translations'

0 comments on commit e11f8f6

Please sign in to comment.