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

**URL:** https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346
**Category:** Support
**Created:** [14 בפברואר,‏ 2017,‏ 9:24am UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346 "2017-02-14T09:24:21Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Alexander\_Wright](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexander_wright/32/119518_2.png) [@Alexander\_Wright](https://meta.discourse.org/u/Alexander_Wright)
#### Post date: [14 בפברואר,‏ 2017,‏ 9:24am UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346/1 "2017-02-14T09:24:21Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [14 בפברואר,‏ 2017,‏ 10:47am UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346/2 "2017-02-14T10:47:54Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [14 בפברואר,‏ 2017,‏ 12:02pm UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346/3 "2017-02-14T12:02:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [14 בפברואר,‏ 2017,‏ 3:25pm UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346/4 "2017-02-14T15:25:21Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [14 בפברואר,‏ 2017,‏ 3:31pm UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346/5 "2017-02-14T15:31:50Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [14 בפברואר,‏ 2017,‏ 3:47pm UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346/6 "2017-02-14T15:47:13Z")

</div>

> [@codinghorror](#):
>
> Why not compile all languages every time that setting is changed?

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [14 בפברואר,‏ 2017,‏ 4:09pm UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346/7 "2017-02-14T16:09:33Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [14 בפברואר,‏ 2017,‏ 6:23pm UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346/8 "2017-02-14T18:23:27Z")

</div>

> [@sam](#):
>
> get rid of sprockets.

A bit off-topic

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

```plaintext
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

```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2 במאי,‏ 2019,‏ 1:47pm UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346/9 "2019-05-02T13:47:06Z")

</div>



---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2 במאי,‏ 2019,‏ 11:04pm UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346/10 "2019-05-02T23:04:25Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2 במאי,‏ 2019,‏ 11:05pm UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346/11 "2019-05-02T23:05:22Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [10 במאי,‏ 2019,‏ 7:42pm UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346/13 "2019-05-10T19:42:20Z")

</div>

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](https://meta.discourse.org/t/how-much-is-discourse-affected-by-a-faster-cpu/58407/37), on my test DO instance the rebuild takes 4m50s (compared to about 7m previously).

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [10 במאי,‏ 2019,‏ 7:42pm UTC](https://meta.discourse.org/t/do-all-the-locale-scripts-have-to-run-on-install-and-upgrade/57346/14 "2019-05-10T19:42:25Z")

</div>


