Error compiling translation strings #9137

Closed
opened 2025-12-29 20:46:08 +01:00 by adam · 1 comment
Owner

Originally created by @jeremystretch on GitHub (Jan 23, 2024).

Originally assigned to: @jeremystretch on GitHub.

Deployment Type

NetBox Cloud

NetBox Version

v3.7.1

Python Version

3.11

Steps to Reproduce

Attempt to compile translation messages using the compilemessages management command.

Expected Behavior

Translations should compile from their .po files without issue.

Observed Behavior

An error is raised. (This occurs with multiple languages.)

$ ./manage.py compilemessages -l ja
processing file django.po in /home/jstretch/projects/netbox/netbox/translations/ja/LC_MESSAGES
Execution of msgfmt failed: /home/jstretch/projects/netbox/netbox/translations/ja/LC_MESSAGES/django.po:7600: 'msgstr' is not a valid Python format string, unlike 'msgid'. Reason: The character that terminates the directive number 1 is not a valid conversion specifier.
/home/jstretch/projects/netbox/netbox/translations/ja/LC_MESSAGES/django.po:7834: 'msgstr' is not a valid Python format string, unlike 'msgid'. Reason: The character that terminates the directive number 1 is not a valid conversion specifier.
msgfmt: found 2 fatal errors
CommandError: compilemessages generated one or more errors.

This is the affected string:

#: ipam/forms/bulk_edit.py:257 ipam/forms/bulk_edit.py:301
#: ipam/models/ip.py:271 ipam/models/ip.py:538
#, python-format
msgid "Treat as 100% utilized"
msgstr "100% 使用済みとして扱う"

I believe the issue stems from the use of a non-escaped percentage sign (%) in the original string.

Originally created by @jeremystretch on GitHub (Jan 23, 2024). Originally assigned to: @jeremystretch on GitHub. ### Deployment Type NetBox Cloud ### NetBox Version v3.7.1 ### Python Version 3.11 ### Steps to Reproduce Attempt to compile translation messages using the `compilemessages` management command. ### Expected Behavior Translations should compile from their `.po` files without issue. ### Observed Behavior An error is raised. (This occurs with multiple languages.) ``` $ ./manage.py compilemessages -l ja processing file django.po in /home/jstretch/projects/netbox/netbox/translations/ja/LC_MESSAGES Execution of msgfmt failed: /home/jstretch/projects/netbox/netbox/translations/ja/LC_MESSAGES/django.po:7600: 'msgstr' is not a valid Python format string, unlike 'msgid'. Reason: The character that terminates the directive number 1 is not a valid conversion specifier. /home/jstretch/projects/netbox/netbox/translations/ja/LC_MESSAGES/django.po:7834: 'msgstr' is not a valid Python format string, unlike 'msgid'. Reason: The character that terminates the directive number 1 is not a valid conversion specifier. msgfmt: found 2 fatal errors CommandError: compilemessages generated one or more errors. ``` This is the affected string: ``` #: ipam/forms/bulk_edit.py:257 ipam/forms/bulk_edit.py:301 #: ipam/models/ip.py:271 ipam/models/ip.py:538 #, python-format msgid "Treat as 100% utilized" msgstr "100% 使用済みとして扱う" ``` I believe the issue stems from the use of a non-escaped percentage sign (`%`) in the original string.
adam added the type: bugstatus: under review labels 2025-12-29 20:46:08 +01:00
adam closed this issue 2025-12-29 20:46:08 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 23, 2024):

Somewhat related, AWS Translate also errors on two help_text strings under CustomLinkForm. We can reformat these to remove the code examples within the strings.

@jeremystretch commented on GitHub (Jan 23, 2024): Somewhat related, AWS Translate also errors on two `help_text` strings under CustomLinkForm. We can reformat these to remove the code examples within the strings.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9137