﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
37253	Translatable strings omitting placeholders in singular form cannot be validated by both msgfmt 0.22 and Transifex	Jacob Walls		"We need to make the singular forms of translatable strings use the same placeholders their plural counterparts do.

----

Some translatable strings in the `humanize` app look like this:
{{{#!py
""past-hour"": ngettext_lazy(""an hour ago"", ""%(count)s hours ago"", ""count""),
}}}

The Serbian (Latin script) locale has this set of translations for it, in its three plural forms:
{{{#!po
#. Translators: please keep a non-breaking space (U+00A0) between count
#. and time unit.
#, python-format
msgid ""an hour ago""
msgid_plural ""%(count)s hours ago""
msgstr[0] ""pre sat""
msgstr[1] ""pre %(count)s sata""
msgstr[2] ""pre %(count)s sati""
}}}

This fails the [https://savannah.gnu.org/bugs/?24025 stricter validation] in `msgfmt` 0.22, which requires the `%(count)s` placeholder to be present in every plural form.

Our usual practice is to fix errors in Transifex and refetch. I attempted to enter this change on Transifex:

{{{#!diff
diff --git a/django/contrib/humanize/locale/sr_Latn/LC_MESSAGES/django.po b/django/contrib/humanize/locale/sr_Latn/LC_MESSAGES/django.po
index d8a24ef699..2aa3bc07a0 100644
--- a/django/contrib/humanize/locale/sr_Latn/LC_MESSAGES/django.po
+++ b/django/contrib/humanize/locale/sr_Latn/LC_MESSAGES/django.po
@@ -220,7 +220,7 @@ msgstr ""pre %(delta)s""
 #, python-format
 msgid ""an hour ago""
 msgid_plural ""%(count)s hours ago""
-msgstr[0] ""pre sat""
+msgstr[0] ""pre %(count)s sat""
 msgstr[1] ""pre %(count)s sata""
 msgstr[2] ""pre %(count)s sati""
}}}

... but I received this error: ""The expression '%(count)s' is not present in the original phrase."" Indeed, the singular form in the catalog is just ""an hour ago"". Apparently, the `msgfmt` validation scheme is incompatible with Transifex's validation.

(As a consequence, the affected .mo file for the humanize app was not recompiled for Django 6.1, but they likely haven't been updated in years, due to the oversight fixed in 30ebe0001c1d10bebc68567f796d821f7b309f4d.)

We could see if this issue would go away if we move to Weblate, but barring that, we need to fix the source strings to always use placeholders in singular forms to avoid compilation problems.

Errors:
{{{
/Users/.../django/django/contrib/humanize/locale/sr_Latn/LC_MESSAGES/django.po:223: a format specification for argument 'count' doesn't exist in 'msgstr[0]'
/Users/.../django/django/contrib/humanize/locale/sr_Latn/LC_MESSAGES/django.po:232: a format specification for argument 'count' doesn't exist in 'msgstr[0]'
/Users/.../django/django/contrib/humanize/locale/sr_Latn/LC_MESSAGES/django.po:241: a format specification for argument 'count' doesn't exist in 'msgstr[0]'
/Users/.../django/django/contrib/humanize/locale/sr_Latn/LC_MESSAGES/django.po:253: a format specification for argument 'count' doesn't exist in 'msgstr[0]'
/Users/.../django/django/contrib/humanize/locale/sr_Latn/LC_MESSAGES/django.po:262: a format specification for argument 'count' doesn't exist in 'msgstr[0]'
/Users/.../django/django/contrib/humanize/locale/sr_Latn/LC_MESSAGES/django.po:271: a format specification for argument 'count' doesn't exist in 'msgstr[0]'
}}}"	Bug	new	contrib.humanize	dev	Normal				Unreviewed	0	0	0	0	0	0
