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: standardize make extract_translations #111

Merged
merged 2 commits into from
May 18, 2023
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
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ ifeq ($(strip $(po_files)),)
endif
mo_files := $(patsubst %.po,%.mo,$(po_files))

WORKING_DIR := $(module_root)
EXTRACT_DIR := $(WORKING_DIR)/conf/locale/en/LC_MESSAGES
EXTRACTED_DJANGO_PARTIAL := $(EXTRACT_DIR)/django-partial.po
EXTRACTED_DJANGO := $(EXTRACT_DIR)/django.po

.PHONY: help
help: ## This.
@perl -ne 'print if /^[a-zA-Z_-]+:.*## .*$$/' $(MAKEFILE_LIST) \
Expand Down Expand Up @@ -133,3 +138,7 @@ docker_shell:
docker_static: ; make build_docker; $(run-in-docker) ## Compile static assets in docker container
docker_translations: ; make build_docker; $(run-in-docker) ## Update translation files in docker container
docker_test: ; make build_docker; $(run-in-docker) ## Run tests in docker container

extract_translations: ## extract strings to be translated, outputting .po files
cd $(WORKING_DIR) && i18n_tool extract
mv $(EXTRACTED_DJANGO_PARTIAL) $(EXTRACTED_DJANGO)
1 change: 0 additions & 1 deletion freetextresponse/conf/locale

This file was deleted.

1 change: 1 addition & 0 deletions freetextresponse/conf/locale/en/LC_MESSAGES/text.po
13 changes: 6 additions & 7 deletions freetextresponse/tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from freetextresponse.models import Credit
from freetextresponse.views import _is_at_least_one_phrase_present # noqa
from freetextresponse.utils import _
from freetextresponse.xblocks import FreeTextResponse

from .tests_utils import make_xblock
Expand Down Expand Up @@ -73,7 +72,7 @@ def test_generate_validation_message(self):
msg = 'weight attempts cannot be negative'
result = ValidationMessage(
ValidationMessage.ERROR,
_(msg)
msg
)
test_result = self.xblock._generate_validation_message(msg)
self.assertEqual(
Expand Down Expand Up @@ -345,7 +344,7 @@ def test_used_attempts_feedback_normal(
self.xblock.max_attempts = max_attempts
self.xblock.count_attempts = count_attempts
self.assertEqual(
_(result),
result,
self.xblock._get_used_attempts_feedback(),
)

Expand All @@ -371,7 +370,7 @@ def test_get_word_count_message(
self.xblock.min_word_count = min_word_count
self.xblock.max_word_count = max_word_count
self.assertEqual(
_(result),
result,
self.xblock._get_word_count_message(),
)

Expand All @@ -391,7 +390,7 @@ def test_get_user_alert(self, **test_data):
self.xblock.min_word_count = test_data['min_word_count']
self.xblock.max_word_count = test_data['max_word_count']
self.assertEqual(
_(str(test_data['result'])),
str(test_data['result']),
self.xblock._get_user_alert(
ignore_attempts=test_data['ignore_attempts']
),
Expand Down Expand Up @@ -420,7 +419,7 @@ def test_get_submitted_message(
)
self.xblock.submitted_message = 'test submission received message'
self.assertEqual(
_(result),
result,
self.xblock._get_submitted_message(),
)

Expand All @@ -436,7 +435,7 @@ def test_get_problem_progress(self, **test_data):
self.xblock.weight = test_data['weight']
self.xblock.score = test_data['score']
self.assertEqual(
_(test_data['result']),
test_data['result'],
self.xblock._get_problem_progress(),
)

Expand Down
1 change: 1 addition & 0 deletions freetextresponse/translations
11 changes: 0 additions & 11 deletions freetextresponse/utils.py

This file was deleted.