Opened 3 months ago

Closed 3 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 Mohammad Ali Mehdizadeh)

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 Mohammad Ali Mehdizadeh, 3 months ago

Description: modified (diff)

comment:2 by Natalia Bidart, 3 months ago

Hello Mohammad Ali Mehdizadeh, thank you for your report. Can you please provide details of what operating system and version are you using?

comment:3 by Natalia Bidart, 3 months ago

Component: UncategorizedInternationalization
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/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 Natalia Bidart, 3 months ago

Cc: Claude Paroz added

comment:5 by Claude Paroz, 3 months ago

Easy pickings: set

I guess it's a matter of adapting the expected error message.

comment:6 by Jericho Serrano, 3 months ago

Owner: set to Jericho Serrano
Status: newassigned

Hi i am new, i wanna try working on this, Thanks

Last edited 3 months ago by Jericho Serrano (previous) (diff)

comment:7 by Jericho Serrano, 3 months ago

Has patch: set

in reply to:  7 comment:8 by Jericho Serrano, 3 months ago

Replying to Jericho Serrano:

Made a PR: https://github.com/django/django/pull/19530

Ah linter errors

comment:9 by Sarah Boyce, 3 months ago

Patch needs improvement: set

comment:10 by Jericho Serrano, 3 months ago

Patch needs improvement: unset

comment:11 by Sarah Boyce, 3 months ago

Triage Stage: AcceptedReady for checkin

comment:12 by Sarah Boyce <42296566+sarahboyce@…>, 3 months ago

Resolution: fixed
Status: assignedclosed

In 1960ecd8:

Fixed #36421 -- Made test_msgfmt_error_including_non_ascii compatible with msgfmt 0.25.

Note: See TracTickets for help on using tickets.
Back to Top