smpallen99 / coherence

Coherence is a full featured, configurable authentication system for Phoenix
MIT License
1.27k stars 224 forks source link

Compilation error in file lib/magnify_web/coherence_messages.ex #340

Closed isAlmogK closed 6 years ago

isAlmogK commented 6 years ago

Just installed coherence and I'm getting the following error

== Compilation error in file lib/magnify_web/coherence_messages.ex ==
** (ArgumentError) *gettext macros expect translation keys (msgid and msgid_plural) and
domains to expand to strings at compile-time, but the given msgid
doesn't.

Dynamic translations should be avoided as they limit gettext's
ability to extract translations from your source code. If you are
sure you need dynamic lookup, you can use the functions in the Gettext
module:

    string = "hello world"
    Gettext.gettext(MagnifyWeb.Gettext, string)

    (gettext) lib/gettext/compiler.ex:231: Gettext.Compiler.expand_to_binary/4
    expanding macro: MagnifyWeb.Gettext.dgettext_noop/2
    lib/magnify_web/coherence_messages.ex:73: MagnifyWeb.Coherence.Messages.you_are_using_an_invalid_security_token/0
    expanding macro: MagnifyWeb.Gettext.dgettext/2
    lib/magnify_web/coherence_messages.ex:73: MagnifyWeb.Coherence.Messages.you_are_using_an_invalid_security_token/0
    (elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

When I remove the following #def you_are_using_an_invalid_security_token, do: dgettext(@domain, "You are using an invalid security token for this site! This security\n" <> "violation has been logged.\n")

It compiles and runs I do get the following warning

warning: function you_are_using_an_invalid_security_token/0 required by behaviour Coherence.Messages is not implemented (in module MagnifyWeb.Coherence.Messages)
  lib/magnify_web/coherence_messages.ex:1
isAlmogK commented 6 years ago

fixed based on the following - https://github.com/smpallen99/coherence/issues/337#issuecomment-381298134