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

Bugfix on Portuguese translation #188

Merged
merged 3 commits into from
Oct 31, 2024
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
Binary file modified survey/locale/de/LC_MESSAGES/django.mo
Binary file not shown.
Binary file modified survey/locale/es/LC_MESSAGES/django.mo
Binary file not shown.
Binary file modified survey/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
Binary file added survey/locale/gr/LC_MESSAGES/django.mo
Binary file not shown.
Binary file modified survey/locale/id/LC_MESSAGES/django.mo
Binary file not shown.
Binary file modified survey/locale/ja/LC_MESSAGES/django.mo
Binary file not shown.
Binary file modified survey/locale/nl/LC_MESSAGES/django.mo
Binary file not shown.
Binary file modified survey/locale/pl/LC_MESSAGES/django.mo
Binary file not shown.
Binary file modified survey/locale/pt/LC_MESSAGES/django.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion survey/locale/pt/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#: dev/templates/base.html:3
msgid "en"
Expand Down
Binary file modified survey/locale/ru/LC_MESSAGES/django.mo
Binary file not shown.
Binary file modified survey/locale/tr/LC_MESSAGES/django.mo
Binary file not shown.
Binary file modified survey/locale/zh/LC_MESSAGES/django.mo
Binary file not shown.
16 changes: 14 additions & 2 deletions survey/tests/locale/test_locale_normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ class TestLocaleNormalization(unittest.TestCase):
LOCALE_PATH = Path("survey", "locale").absolute()

def test_normalization(self):
"""We test if the messages were properly created with makemessages --no-obsolete --no-wrap."""
"""Messages need to be created with the proper 'makemessages' then 'compilemessages'."""
if platform.system() == "Windows":
python_3 = ["py", "-3"]
else:
python_3 = ["python3"]
base_command = ["manage.py", "makemessages", "--no-obsolete", "--no-wrap", "--ignore", "venv"]
compile_message_base_command = ["manage.py", "compilemessages"]
makemessages_command = python_3 + base_command
if django_version > "3.0":
for x in settings.LANGUAGES:
Expand All @@ -27,14 +28,16 @@ def test_normalization(self):
logging.warning("Command to launch for makemessages is : %s", " ".join(makemessages_command))

subprocess.check_call(makemessages_command)
compile_message_command = python_3 + compile_message_base_command
subprocess.check_call(compile_message_command)
git_diff_command = ["git", "diff", self.LOCALE_PATH]
git_diff = subprocess.check_output(git_diff_command).decode("utf8")
command_as_str = " ".join(makemessages_command)
msg = (
"You did not update the translation following your changes. Maybe you did not use the "
"normalized 'python3 manage.py makemessages --no-obsolete --no-wrap' ? If you're "
f"working locally, just use 'git add {self.LOCALE_PATH}', we launched "
f"'{command_as_str}' during tests.\ngit diff\n{git_diff}",
f"'{command_as_str}' during tests.\ngit diff\n{git_diff}"
)
number_of_change = git_diff.count("@@") / 2
if django_version >= "4.1":
Expand All @@ -47,3 +50,12 @@ def test_normalization(self):
number_of_language = len(os.listdir(self.LOCALE_PATH))
expected_number_of_change = number_of_language
self.assertEqual(number_of_change, expected_number_of_change, msg)
number_of_bin_differring = git_diff.count("differ\n")
command_as_str = " ".join(compile_message_command)
msg = (
"You did not compile the messages following your changes. Maybe you did not use "
"'python3 manage.py compilemessages' ? If you're "
f"working locally, just use 'git add {self.LOCALE_PATH}', we launched "
f"'{command_as_str}' during tests.\ngit diff\n{git_diff}"
)
self.assertEqual(number_of_bin_differring, 0, msg)
Loading