Do all the locale scripts have to run on install and upgrade?

Running all the locale scripts seems to take a long time when installing or upgrading.

Is it possible to restrict the set of locales that are installed?

I wish it would skip these files too. I think we need to replace Sprockets before we can do that right @sam?

1 Like

Sort of, the trouble is that when locale is switched in admin we would have to compile an asset conditionally, this would add a reasonable amount of complexity

2 Likes

Why not compile all languages every time that setting is changed?

Then at least you pay the penalty at time of switch rather than all the time forever and constantly…

Another alternative is to only compile the set locale at rebuild and run a background task to compile the others? (no idea if this is feasible, just a thought that ran through my mind)

It is doable but has risks, for one we don’t have a system that is able to do any background work on site setting change and notify UI when done (double needed when user locale is enabled), I would hold off on all engineering here till we get rid of sprockets.

4 Likes

Another option is env variable that must be set for any locale other than English, so we can skip all that work unless env is set. Maybe ask user at command line if they plan to ever use any other langs.

1 Like

A bit off-topic

I won’t concern myself with worrying about my seeing these

DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors

This is still the source of much pain and makes rebuilds very slow due to all the locales that sites are not using, but yet every single locale has to be processed on every rebuild @sam.

4 Likes

Yes, I am bumping this to the front of @pmusaraj list next week. We have many plans of improving this and got to make it happen.

5 Likes

Locales are still being compiled on rebuild, but the process is now faster due to some improvements in how they are compressed (which was taking the most time on rebuilds). On the most basic DO instance, for example, precompiling each locale takes less than 0.1 seconds now.

Rebuilds are now about 25% faster, on my test DO instance the rebuild takes 4m50s (compared to about 7m previously).

8 Likes