On the "Localize date formats" page (admin/config/regional/date-time/locale/%/edit), every possible format is shown for every possible date-time type. This is a different behavior than at admin/config/regional/date-time which only shows date-time formats corresponding to the date-time type.

Comments

bfroehle’s picture

Status: Active » Needs review
StatusFileSize
new2.21 KB

And a patch, mostly copied from system_date_time_settings.

Status: Needs review » Needs work

The last submitted patch, 989894-1.patch, failed testing.

bfroehle’s picture

Status: Needs work » Needs review
StatusFileSize
new3.83 KB

Thank you automated testing. Localize date formats test changed slightly to set valid short, medium, and long formats for each language.

bfroehle’s picture

~

bfroehle’s picture

#3: 989894-3.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 989894-3.patch, failed testing.

bfroehle’s picture

Status: Needs work » Needs review

#3: 989894-3.patch queued for re-testing.

sun’s picture

Status: Needs review » Needs work
+++ modules/locale/locale.admin.inc
@@ -1397,20 +1397,42 @@ function locale_date_format_form($form, &$form_state, $langcode) {
+  $all_formats = array();
...
+  foreach ($date_formats as $type => $format_info) {
+    $all_formats = array_merge($all_formats, $format_info);

This merge makes no sense to me.

+++ modules/locale/locale.admin.inc
@@ -1397,20 +1397,42 @@ function locale_date_format_form($form, &$form_state, $langcode) {
+  drupal_static_reset('system_get_date_formats');
+  $date_formats = system_get_date_formats(); // Call this to rebuild the list, and to have default list.

I do not understand why we need to reset the static cache here. The form constructor is invoked very early in the page request, so I'm not sure why the static cache should be populated already, and perhaps more importantly, even it would be populated already, why we can't work off that existing info.

+++ modules/locale/locale.admin.inc
@@ -1397,20 +1397,42 @@ function locale_date_format_form($form, &$form_state, $langcode) {
+  $date_formats = system_get_date_formats(); // Call this to rebuild the list, and to have default list.

This comment looks superfluous to me -- doesn't explain anything that the function name wouldn't denote already.

+++ modules/locale/locale.admin.inc
@@ -1397,20 +1397,42 @@ function locale_date_format_form($form, &$form_state, $langcode) {
-  reset($formats);
...
+    reset($formats);

I don't see any usage of current(), next(), or prev() in this code, so I'm not sure why this reset() is required at all...?

Powered by Dreditor.

bfroehle’s picture

StatusFileSize
new132.88 KB
new87.39 KB

Here's a visual of this issue. The first attached image are the date type formats for 'long'. The second are those for 'long' in the French localization.

bfroehle’s picture

@sun, almost all of the code was aped from system_date_time_settings, which explains many of the weirdnesses you pointed out above.

Since I don't actually know the "proper" functioning for this page, especially when it comes to the form respecting 'locales' specified with the date formats, I'm going to let this one go until I do a little more homework.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.