﻿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
35973	makemessages: is_valid_locale regex fails to validate locales with numeric region codes	Juan Pablo Mallarino	Juan Pablo Mallarino	"The **is_valid_locale** function in the **makemessages** management command uses a regular expression that doesn't account for locales with numeric region codes, such as ''es_419''. The current regex only allows uppercase letters after the underscore. This excludes valid locale codes that use numbers in the region subtag.

This can cause issues when trying to generate message files for these locales. For example, running makemessages with ''es_419'' will not generate the expected message files, potentially leading to missing translations.

Proposed Solution

Modify the regular expression in is_valid_locale to include numeric characters in the region subtag validation. The suggested change is:

From:

{{{
r""^[a-z]+_[A-Z].*$""
}}}

To:

{{{
r""^[a-z]+_[A-Z0-9].*$""
}}}

This change would allow the validation of locales while still maintaining the expected format for other locale codes. This simple modification would ensure broader compatibility and avoid unexpected behavior when working with valid locales containing numeric region codes."	Bug	closed	Internationalization	4.2	Normal	fixed	makemessages, i18n	Juan Pablo Mallarino	Ready for checkin	1	0	0	0	0	0
