Skip to content

docs: using gettext in Ash.Type.Enum is misleading #2172

@hwuethrich

Description

@hwuethrich

Using gettext as label/description in Ash.Type.Enum will always use the default locale, because the options are evaluated at compile time.

The example gives the impression that the value/1 and description/1 functions would return the value based on the current locale at runtime. It would be great if this worked, but I don't see an easy fix, right?

ash/lib/ash/type/enum.ex

Lines 73 to 75 in f9b6b5c

escalated: [description: gettext("An escalated ticket")],
follow_up: [label: gettext("Follow up")],
closed: [description: gettext("A closed ticket"), label: gettext("Closed")]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions