-
-
Save amatalai/1877f48a195f578682cfd20e66c6544e to your computer and use it in GitHub Desktop.
Workaround for gettext.extract issue with umbrella app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Mix.Tasks.Gettext.Extract.Umbrella do | |
use Mix.Task | |
@recursive false | |
def run(args) do | |
unless Mix.Project.umbrella?() do | |
msg = | |
"Cannot run task gettext.extract.umbrella from place " <> | |
"other than umbrella application root dir." | |
Mix.raise(msg) | |
end | |
_ = Application.ensure_all_started(:gettext) | |
force_recompile_and_extract() | |
Mix.Task.run("gettext.extract", args) | |
end | |
defp force_recompile_and_extract do | |
Gettext.Extractor.enable() | |
Mix.Task.run("compile", ["--force"]) | |
after | |
Gettext.Extractor.disable() | |
end | |
end |
😄
Hi @amatalai I couldn't use your Workaround, I crate a folder on "apps/mix/tasks/gettext.extract.umbrella.ex"
after that I call it
mix gettext.extract.umbrella
warning: path "apps/tasks" is a directory but it has no mix.exs. Mix won't consider this directory as part of your umbrella application. Please add a "mix.exs" or set the ":apps" key in your umbrella configuration with all relevant apps names as atoms
for first time it compiles and show me some warning . should I create a project just for Gettext? do you have any example ?
Hi @amatalai I couldn't use your Workaround, I crate a folder on
"apps/mix/tasks/gettext.extract.umbrella.ex"
after that I call itmix gettext.extract.umbrella warning: path "apps/tasks" is a directory but it has no mix.exs. Mix won't consider this directory as part of your umbrella application. Please add a "mix.exs" or set the ":apps" key in your umbrella configuration with all relevant apps names as atoms
for first time it compiles and show me some warning . should I create a project just for Gettext? do you have any example ?
create it in apps/any_of_your_apps/lib/mix/tasks
Thank you so much! This saved my career life, bro!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You, sir, are my hero. Thank you so much. <3