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

Configuring :otp_app changes the location of the locale files #238

Open
kipcole9 opened this issue Aug 29, 2024 · 0 comments
Open

Configuring :otp_app changes the location of the locale files #238

kipcole9 opened this issue Aug 29, 2024 · 0 comments

Comments

@kipcole9
Copy link
Collaborator

Per the elixir slack thread:

The runtime data_dir option resolves to _build/dev/lib/my_app/priv/cldr (and _build/dev/lib/my_app/priv is linked to priv at the project level, which is under source control). But I understand from your example, that it should point to the ex_cldr lib folder, not the my_app subfolder.

I think I’ve figured it out: a month ago I refactored our Cldr setup, and added the :otp_app config option to the Cldr backend. At the time I didn’t read the documentation well enough to anticipate that this also had an effect on the data_dir. So before that change, the data_dir resolved to the priv_dir of :ex_cldr, which is ultimately under the deps folder (not versioned by git). Once I configured the :otp_app config key, the data_dir resolved to the priv_dir of our app (which is under revision control).

What made this a difficult debug session was the fact that introducing the :otp_app config key didn’t immediately resulted in the behaviour as described, for the locale json files. There is a path in the code that falls back to the cldr_data_dir (which was the previous location). As long as the json locale files existed in the old location, there was no trigger to download them to the new location.
So this observation wasn’t a direct result from upgrading to the latest version (but it did trigger a recompilation, or maybe I wiped out the deps folder, I can’t remember), no worries there.

What surprises me a bit is that the documentation encourages specifying the :otp_app key, which ultimately drives the Cldr data_dir to become part of your priv directory. I don’t think there are good reasons to have it there (at least not under git revision control). And therefore, the suggestion surprises me. Having the locale files under the priv_dir of :ex_cldr seems to work just fine. Or am I wrong here, when people configure multiple Cldr backends, then there will be some kind of clash?

@kipcole9 kipcole9 changed the title Configuring :opt_app changes the location of the locale files Configuring :otp_app changes the location of the locale files Aug 29, 2024
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

1 participant