timex
timex copied to clipboard
Gettext v0.26 breaks compilation
Steps to reproduce
Upgrade gettext to latest version (0.26)
Description of issue
==> timex
Compiling 62 files (.ex)
warning: defining a Gettext backend by calling
use Gettext, otp_app: ..., ...
is deprecated. To define a backend, call:
use Gettext.Backend, otp_app: :my_app
Then, to use the backend, call this in your module:
use Gettext, backend: MyApp.Gettext
error: undefined function dngettext/4 (there is no such import)
│
255 │ dngettext("units", "%{count} nanosecond", "%{count} nanoseconds", 0)
│ ^
│
└─ lib/l10n/translator.ex:255:3: Timex.Translator (module)
We had the same issue this morning : one of my co-worker updated to Gettext 0.26 and had the following error message when compiling.
error: undefined function dngettext/4 (there is no such import)
│
255 │ dngettext("units", "%{count} nanosecond", "%{count} nanoseconds", 0)
│ ^
│
└─ lib/l10n/translator.ex:255:3: Timex.Translator (module)
== Compilation error in file lib/l10n/translator.ex ==
** (CompileError) lib/l10n/translator.ex: cannot compile module Timex.Translator (errors have been logged)
could not compile dependency :timex, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile timex --force", update it with "mix deps.update timex" or clean it with "mix deps.clean timex"
Gettext 0.25 works well with Timex, but 0.26 brings changes in how to call Gettext Backends indeed, which breaks Gettext function calls inside /lib/l10n/translator.ex .
Ah, I think 0.26.1 (released a few minutes ago) fixes this part of the backwards compatibility. Timex now compiles for me.
https://github.com/elixir-gettext/gettext/blob/main/CHANGELOG.md#v0261