Skip to content

Support gettext ~> 1.0 for Phoenix 1.8 compatibility #859

Description

@bmalum

Beacon's mix.exs specifies {:gettext, "~> 0.26"}, which prevents installation in Phoenix 1.8 projects that require {:gettext, "~> 1.0"}.

Because "your app" depends on "beacon ~> 0.5" which depends on "gettext ~> 0.26",
"gettext ~> 0.26" is required.
So, because "your app" depends on "gettext ~> 1.0", version solving failed.

The fix is trivial — Beacon's codebase already uses the gettext 1.0-compatible API everywhere:

  • lib/beacon/gettext.ex uses use Gettext.Backend, otp_app: :beacon
  • All consumers use use Gettext, backend: Beacon.Gettext
  • translate_error/1 calls Gettext.dngettext/6 and Gettext.dgettext/4 directly (not deprecated macros)

The only change needed is in mix.exs:

- {:gettext, "~> 0.26"},
+ {:gettext, "~> 0.26 or ~> 1.0"},

This maintains backward compatibility with gettext 0.26 while allowing gettext 1.0+.

Steps to reproduce:

  1. mix phx.new my_app (Phoenix 1.8)
  2. Add {:beacon, "~> 0.5"} to deps
  3. mix deps.get → Hex resolution failure

Environment:

  • Elixir 1.18+ / OTP 27
  • Phoenix 1.8 (ships with {:gettext, "~> 1.0"})
  • Beacon 0.5.x and main branch

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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