Repository: wagtail/wagtail
File: wagtail/admin/templatetags/wagtailadmin_tags.py (Python)

Code before:


@register.simple_tag()
def workflow_status_with_date(workflow_state):
    translation_context = {
        "finished_at": naturaltime(workflow_state.current_task_state.finished_at),
        "started_at": naturaltime(workflow_state.current_task_state.started_at),
        "task_name": workflow_state.current_task_state.task.name,
        "status_display": workflow_state.get_status_display,
    }

    if workflow_state.status == "needs_changes":
        return _("Changes requested %(finished_at)s") % translation_context

    if workflow_state.status == "in_progress":
        return _("Sent to %(task_name)s %(started_at)s") % translation_context

    return _("%(status_display)s %(task_name)s %(started_at)s") % translation_context


@register.inclusion_tag("wagtailadmin/shared/keyboard_shortcuts_dialog.html", takes_context=True)
def keyboard_shortcuts_dialog(context):
    user_agent = context["request"].headers.get("User-Agent", "")
    is_mac = re.search(r"Mac|iPod|iPhone|iPad", user_agent)
    return {
        "meta": "⌘" if is_mac else "Ctrl",
    }


@register.inclusion_tag("wagtailadmin/shared/human_readable_date.html")
def human_readable_date(date, description=None, placement="top"):
    if isinstance(date, datetime.datetime):
        tooltip_format = getattr(settings, "DATETIME_FORMAT", "N j, Y, P")
    elif isinstance(date, datetime.date):
        tooltip_format = getattr(settings, "DATE_FORMAT", "N j, Y")
    return {
        "date": date,
        "description": description,
        "placement": placement,
        "tooltip_format": tooltip_format,
    }


# Shadow the laces `component` tag which was extracted from Wagtail. The shadowing
# is useful to avoid having to update all the templates that use the `component` tag.
register.tag("component", component)


Review comment (suggestion):
```suggestion
        "mod": "⌘" if is_mac else "Ctrl",
```

Just realised we should be calling this `mod` not `meta` - mod seems to be the convention for things like this. 

The template would also need to be updated. 

Code after:


@register.simple_tag()
def workflow_status_with_date(workflow_state):
    translation_context = {
        "finished_at": naturaltime(workflow_state.current_task_state.finished_at),
        "started_at": naturaltime(workflow_state.current_task_state.started_at),
        "task_name": workflow_state.current_task_state.task.name,
        "status_display": workflow_state.get_status_display,
    }

    if workflow_state.status == "needs_changes":
        return _("Changes requested %(finished_at)s") % translation_context

    if workflow_state.status == "in_progress":
        return _("Sent to %(task_name)s %(started_at)s") % translation_context

    return _("%(status_display)s %(task_name)s %(started_at)s") % translation_context


@register.inclusion_tag(
    "wagtailadmin/shared/keyboard_shortcuts_dialog.html",
    takes_context=True,
)
def keyboard_shortcuts_dialog(context):
    """
    Renders the keyboard shortcuts dialog content with the
    appropriate shortcuts for the user's platform.
    Note: Shortcut keys are intentionally not translated.
    """

    user_agent = context["request"].headers.get("User-Agent", "")
    is_mac = re.search(r"Mac|iPod|iPhone|iPad", user_agent)
    modifier = "⌘" if is_mac else "Ctrl"

    return {
        "shortcuts": {
            ("actions-common", _("Common actions")): [
                (_("Copy"), f"{modifier} + c"),
                (_("Cut"), f"{modifier} + x"),
                (_("Paste"), f"{modifier} + v"),
                (
                    _("Paste and match style")
                    if is_mac
                    else _("Paste without formatting"),
                    f"{modifier} + Shift + v",
                ),
                (_("Undo"), f"{modifier} + z"),
                (
                    _("Redo"),
                    f"{modifier} + Shift + z" if is_mac else f"{modifier} + y",