opened
amatalai
username_0
When you run `mix gettext.extract` from umbrella root not every module is forced to recompile, which causes translations to disappear.

Example repo: https://github.com/username_0/gettext_umbrella_issue

Probably somehow related to #165
Translations are dissapearing in umbrella
issue
created
maennchen
username_1
@username_2 I'm having the same issue as well. Was there anything done in the meantime that should solve the issue?
comment
created
josevalim
username_2
@username_0's workaround seems to be the way to go for now.
comment
created
maennchen
username_1
@username_2 Could the workaround be incorporated into the extract mix task directly?

(Via Arg / Config / somehow detect the umbrella)
comment
created
maennchen
username_1
(As always I'd be happy to provide a PR :smiley: if that is welcome)
comment
created
josevalim
username_2
I think the work around can be more efficient but I didn't have time to look at it yet, unfortunately.
comment
created
josevalim
username_2
Hi @username_1, I will take some time this week to look at this. Can you please make sure those problems happen in the initial repo: https://github.com/username_0/gettext_umbrella_issue  - feel free to fork it. Looking at a minimal app is going to make it a bit easier for me to address it. :)
comment
created
maennchen
username_1
@username_2 I'll have a look if I can reproduce it there. :+1:
comment
created
josevalim
username_2
@username_1 I noticed this fell through my cracks. The offer still stands if you are game. :)
comment
created
maennchen
username_1
@username_2 it also fell through my cracks. I'll have a look next week since I'm currently on vacation.
comment
created
josevalim
username_2
Enjoy the holidays!
comment
created
maennchen
username_1
@username_2 I'm having trouble reproducing it in a minimal repo.

The things that are "special" about hygeia could be:

* Long compilation times: `ex_cldr` / `cadastre` / `apps/hygeia/lib/hygeia/ecto_type/noga.ex` take quite some time to compile
  - Also there's a bit of a mess in the compilation that I should probably clean up since it takes much too long overall
  - For example, a lot of changes cause basically everything to recompile
* The umbrella  apps are depending on each other a lot, especially on the gettext app

Do you have an idea how I could reproduce that in a minimal repo?

The Hygeia repo itself should demonstrate the issue nicely, other than it compiling very slowly, it should demonstrate the issue.
comment
created
josevalim
username_2
I assume you tried to reproduce from the bottom up. What if you try from the top down? I.e. by getting the current app and stripping as much code and deps as you can?
comment
created
maennchen
username_1
@username_2 I haven't tried that yet. Mainly because it takes forever with the current compilation times.

But there's probably no way around it than to do it in reverse. I'll give it a try.
comment
created
maennchen
username_1
@username_2 I was able to reduce it a lot. It for sure has nothing to do with the compilation time or any of the apps...

I removed so much that I can't see anymore how this would be different from any other project except the `gettext.extract.umbrella` mix task.

https://github.com/username_1/elixir-gettext-issue-178

## To Reproduce

* Use Elixir / Erlang Versions as written in `.tool-versions` (ASDF)
* Run `mix deps.get`
* Run `mix gettext.extract.umbrella` twice

## Problems

### Warning

The following warning should be logged:

```
warning: the Gettext backend HygeiaGettext has the same :priv directory as HygeiaGettext, which means they will override each other. Please set the :priv option to different directories on use Gettext inside each backend
  (elixir 1.12.1) lib/enum.ex:2356: Enum."-reduce/3-lists^foldl/2-0-"/3
  (gettext 0.18.2) lib/gettext/extractor.ex:80: Gettext.Extractor.pot_files/2
  (gettext 0.18.2) lib/mix/tasks/gettext.extract.ex:55: Mix.Tasks.Gettext.Extract.extract/2
  (gettext 0.18.2) lib/mix/tasks/gettext.extract.ex:37: Mix.Tasks.Gettext.Extract.run/1
  (mix 1.12.1) lib/mix/task.ex:394: anonymous fn/3 in Mix.Task.run_task/3
  (mix 1.12.1) lib/mix/project.ex:353: Mix.Project.in_project/4
```

### `elixir-format`

The following translation is appended to the `default.pot`:

```
#, elixir-format
#: lib/hygeia_gettext/test.ex:4 lib/hygeia_gettext/test.ex:4
msgid "Test!"
msgstr ""
```

Expected would be without the `elixir-format` flag

### Not removed

No longer needed translations are not removed. This forces me to do the following in the full `hygeia` application:

* Manually remove everything from the `pot` except the header
* Delete files in `_build` (`rm -rf _build/dev/lib/hygeia*`)
* Extract Twice using `mix gettext.extract.umbrella` (The first time somehow no translations are added)
comment
created
maennchen
username_1
@username_2 Is there anything else I can do to narrow down the issue?
comment
created
josevalim
username_2
Hi @username_1! Thanks for isolating it. I will probably have time to look at this in a week or two, meanwhile it will be sitting on my inbox, so I will get to it as soon as I can. :)
comment
created
maennchen
username_1
@username_2 Thanks & no hurry, it's not super urgent for me. If I can be of further help, just let me know :)
comment