Opened 5 months ago
Closed 5 months ago
#36421 closed Cleanup/optimization (fixed)
Support for msgfmt==0.25
| Reported by: | Mohammad Ali Mehdizadeh | Owned by: | Jericho Serrano |
|---|---|---|---|
| Component: | Internationalization | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Claude Paroz | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
When I run tests on my machine with msgfmt==0.25, one test failed:
======================================================================
FAIL: test_msgfmt_error_including_non_ascii (i18n.test_compilation.CompilationErrorHandling.test_msgfmt_error_including_non_ascii)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mam/.pyenv/versions/3.12.5/lib/python3.12/unittest/case.py", line 58, in testPartExecutor
yield
File "/home/mam/.pyenv/versions/3.12.5/lib/python3.12/unittest/case.py", line 634, in run
self._callTestMethod(testMethod)
^^^^^^^^^^^^^^^^^
File "/home/mam/.pyenv/versions/3.12.5/lib/python3.12/unittest/case.py", line 589, in _callTestMethod
if method() is not None:
^^^^^^^^^^^^^^^^^
File "/home/mam/mycode/django/tests/i18n/test_compilation.py", line 281, in test_msgfmt_error_including_non_ascii
self.assertIn("' cannot start a field name", stderr.getvalue())
^^^^^^^^^^^^^^^^^
File "/home/mam/.pyenv/versions/3.12.5/lib/python3.12/unittest/case.py", line 1152, in assertIn
self.fail(self._formatMessage(msg, standardMsg))
^^^^^^^^^^^^^^^^^
File "/home/mam/.pyenv/versions/3.12.5/lib/python3.12/unittest/case.py", line 715, in fail
raise self.failureException(msg)
^^^^^^^^^^^^^^^^^
AssertionError: "' cannot start a field name" not found in "Execution of msgfmt failed: /tmp/django_6kqdkmj8/i18n_i8h9ij4r/commands/locale/ko/LC_MESSAGES/django.po:24: 'msgstr' is not a valid Python brace format string, unlike 'msgid'. Reason: In the directive number 0, a field name starts with a character that is not alphanumerical or underscore.\nmsgfmt: found 1 fatal error\n"
----------------------------------------------------------------------
Ran 17523 tests in 155.582s
FAILED (failures=1, skipped=1597, expected failures=5)
Change History (12)
comment:1 by , 5 months ago
| Description: | modified (diff) |
|---|
comment:2 by , 5 months ago
comment:3 by , 5 months ago
| Component: | Uncategorized → Internationalization |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
| Type: | Uncategorized → Cleanup/optimization |
I have downloaded gettext 0.25 and built it locally. I have pointed my terminal at the built libs and binaries:
$ msgfmt --version msgfmt (GNU gettext-tools) 0.25
I can confirm that the test in the description fails for gettext version 0.25. It's worth noting that 0.25 is not easily available (yet). While binaries are available for Windows, latest version of Ubuntu is still shipping 0.23.
comment:4 by , 5 months ago
| Cc: | added |
|---|
comment:5 by , 5 months ago
| Easy pickings: | set |
|---|
I guess it's a matter of adapting the expected error message.
comment:6 by , 5 months ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
follow-up: 8 comment:7 by , 5 months ago
| Has patch: | set |
|---|
Made a PR: https://github.com/django/django/pull/19530
comment:8 by , 5 months ago
Replying to Jericho Serrano:
Made a PR: https://github.com/django/django/pull/19530
Ah linter errors
comment:9 by , 5 months ago
| Patch needs improvement: | set |
|---|
comment:10 by , 5 months ago
| Patch needs improvement: | unset |
|---|
comment:11 by , 5 months ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Hello Mohammad Ali Mehdizadeh, thank you for your report. Can you please provide details of what operating system and version are you using?