Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Disable i18n lazy loading on CI

Christophe Bliard3935a0994c10
diff --git a/spec/support/i18n_lazy_loading.rb b/spec/support/i18n_lazy_loading.rb
index 4b71bf5e58f..7b37aaaa24a 100644
--- a/spec/support/i18n_lazy_loading.rb
+++ b/spec/support/i18n_lazy_loading.rb
@@ -28,12 +28,17 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-# Lazy loads translations based on the current locale.
-# It avoids a 2 to 4 seconds penalty when all locales are loaded.
-# Need to make LocaleExtractor recognize our js-<locale>.yaml file format
+# Enable translations lazy loading by default, except on CI where we want to
+# have all translations loaded during application eager loading to be closer to
+# production configuration.
+return if ENV["CI"]
+# Lazy loading translations avoids a 2 to 4 seconds penalty on first call to
+# `I18n.translate` by loading only the translations for the current locale
+# instead of loading them for all locales.
require "i18n/backend/lazy_loadable"
+# Need to make LocaleExtractor recognize our js-<locale>.yaml file format
class I18n::Backend::LocaleExtractor
def self.locale_from_path(path)
name = File.basename(path, ".*")