Right now, the custom date format in a date field handler is not translatable. If English text is included in the custom format (e.g. M d, Y \a\t g:ia), this text will appear in other languages too, and will not be available for translation.

The current patch fixes this.

Comments

infojunkie’s picture

Status: Active » Needs review
StatusFileSize
new667 bytes

Patch attached.

infojunkie’s picture

Issue summary: View changes

Better wording

chris matthews’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll

The 6 year old patch to views_handler_field_date.inc does not apply to the latest views 7.x-3.x-dev and if still applicable needs reroll.

Checking patch handlers/views_handler_field_date.inc...
error: while searching for:
          if ($custom_format == 'r') {
            return format_date($value, $format, $custom_format, $timezone, 'en');
          }
          return format_date($value, $format, $custom_format, $timezone);
        default:
          return format_date($value, $format, '', $timezone);
      }

error: patch failed: handlers/views_handler_field_date.inc:92
error: handlers/views_handler_field_date.inc: patch does not apply
andrew answer’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new662 bytes

Patch rerolled.

renatog’s picture

Status: Needs review » Reviewed & tested by the community

Yeah, it really makes sense. Tested and with patch #3 this text will appear to be translatable. Thank you so much for your contribution people

mustanggb’s picture

Status: Reviewed & tested by the community » Needs work

Seems like a bit of a hack, wouldn't it be better to use drupal_alter().

Nevermind, seems like D8 might do it using translate, so fair enough.

mustanggb’s picture

Status: Needs work » Reviewed & tested by the community

Restoring status.

damienmckenna’s picture

Should the other uses of $custom_format or $second_custom_format also be wrapped in t()?

On an aside, the logic in views_handler_field_date::render() is rather peculiar, I think I'll set up a different issue for that.

damienmckenna’s picture

Category: Bug report » Task
Status: Reviewed & tested by the community » Fixed
Parent issue: » #3232189: Plan for Views 7.x-3.26

Committed. Thanks everyone.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.