Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to compile with latest gettext #425

Open
benrom opened this issue Dec 12, 2017 · 4 comments
Open

Fails to compile with latest gettext #425

benrom opened this issue Dec 12, 2017 · 4 comments

Comments

@benrom
Copy link
Contributor

benrom commented Dec 12, 2017

When compiling my project with both ex_admin@latest and latest [email protected], the mix deps.compile build fails after these warnings:

09:50:47.141 [error] /Users/chris/code/elixir_server/_build/dev/lib/ex_admin/priv/gettext/pl_PL/LC_MESSAGES/default.po:6: translation is missing plural form 2 which is required by the locale "pl_PL"
warning: variable "repo" does not exist and is being expanded to "repo()", please use parentheses to remove the ambiguity or change
09:50:47.539 [error] /Users/chris/code/elixir_server/_build/dev/lib/ex_admin/priv/gettext/ru_RU/LC_MESSAGES/default.po:6: translation is missing plural form 2 which is required by the locale "ru_RU"

09:50:47.608 [error] /Users/chris/code/elixir_server/_build/dev/lib/ex_admin/priv/gettext/uk_UA/LC_MESSAGES/default.po:6: translation is missing plural form 2 which is required by the locale "uk_UA"

== Compilation error in file lib/ex_admin/paginate.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(ExAdmin.Gettext, string)

    (gettext) lib/gettext/compiler.ex:213: Gettext.Compiler.expand_to_binary/4
    expanding macro: ExAdmin.Gettext.dgettext_noop/2
    lib/ex_admin/paginate.ex:58: ExAdmin.Paginate.pagination_information/2
    expanding macro: ExAdmin.Gettext.dgettext/3
    lib/ex_admin/paginate.ex:58: ExAdmin.Paginate.pagination_information/2
    expanding macro: ExAdmin.Gettext.gettext/1
    lib/ex_admin/paginate.ex:58: ExAdmin.Paginate.pagination_information/2
    (elixir) expanding macro: Kernel.to_string/1
    lib/ex_admin/paginate.ex:58: ExAdmin.Paginate.pagination_information/2
    expanding macro: Xain.text/1
    lib/ex_admin/paginate.ex:58: ExAdmin.Paginate.pagination_information/2
    expanding macro: Xain.markup/1
    lib/ex_admin/paginate.ex:57: ExAdmin.Paginate.pagination_information/2
    (elixir) lib/kernel/parallel_compiler.ex:121: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1
could not compile dependency :ex_admin, "mix compile" failed. You can recompile this dependency with "mix deps.compile ex_admin", update it with "mix deps.update ex_admin" or clean it with "mix deps.clean ex_admin"

Another of my dependencies shows warnings during compilation (timex) but it does not break the build.

No such problem with [email protected], that must be linked to that new 0.14.0 feature:

Warn when compiling and raise at runtime for missing plural forms

I will stick to 0.13.x for now.

My environment:
Erlang/OTP 20 [erts-9.1.4]
Elixir 1.5.2

@chebykin
Copy link

the same for me

Erlang/OTP 20.1.7 [erts-9.1.5]
Elixir 1.5.2


@benrom thanks for the suggested gettext downgrade

@cdesch
Copy link

cdesch commented Dec 15, 2017

I ran into the same problem on ExAdmin 6783c29ec8e62d36d80c87e69511793a80eb8f7c ({:ex_admin, github: "smpallen99/ex_admin"}, after upgrading to:

  {:coherence, "~> 0.4.0"},
  {:scrivener_ecto, "~> 1.1"},
  {:comeonin, "~> 3.0"},

Changing gettext from

   {:gettext, "~> 0.11"},

to:

  {:gettext, "~> 0.13.1"},

Fixed it for me.


Erlang/OTP 19 [erts-8.2.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Elixir 1.5.0

@ardhitama
Copy link

ardhitama commented Dec 21, 2017

@smpallen99 can you please check @nghitran 's PR (#426) ? will help a lot of people

@reubenbrown13
Copy link

I was running into this issue too. I just put the proposed fix in the 1.3 branch. If you want to fix it on your own, go to the lib/ex_admin/paginate.ex on line 58 and change it to:
text (gettext "Displaying ") <> " "

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants