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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Do not use all available languages as i18n fallbacks
Christophe Bliard44572fe4d01f
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rbindex 0db104a15d0..5a99a5d3550 100644--- a/app/controllers/application_controller.rb+++ b/app/controllers/application_controller.rb@@ -152,7 +152,6 @@ class ApplicationController < ActionController::Base:tag_request,:check_if_login_required,:log_requesting_user,- :reset_i18n_fallbacks,:check_session_lifetime,:stop_if_feeds_disabled,:set_cache_buster,@@ -224,14 +223,6 @@ class ApplicationController < ActionController::Basestring.gsub(/[^0-9a-zA-Z@._\-"'!?=\/ ]{1}/, "#")end- def reset_i18n_fallbacks- fallbacks = [I18n.default_locale] + Redmine::I18n.valid_languages.map(&:to_sym)- return if I18n.fallbacks.defaults == fallbacks-- I18n.fallbacks = nil- I18n.fallbacks.defaults = fallbacks- end-def set_localization# 1. Use completely authenticated user# 2. Use user with some authenticated stages not completed.diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rbindex e0e5a345e0a..696514bf902 100644--- a/config/initializers/i18n.rb+++ b/config/initializers/i18n.rb@@ -33,15 +33,13 @@require "open_project/translations/pluralization_backend"I18n::Backend::Simple.include OpenProject::Translations::PluralizationBackend-# Adds fallback to default locale for untranslated strings+# Adds fallback to default locale for untranslated strings. Useful for instance+# during development when adding new strings and using another locale than+# English. For production, that's less useful as files downloaded from Crowdin+# already contain fallback English translations.+#+# Also we can't completly remove the fallback mechanism: we still need the it to+# get translated versions of email header and footer as they are supplied by the+# admins and may not be provided for all configured languages. (See+# `Setting#localized_emails_header` and `Setting#localized_emails_footer`.)I18n::Backend::Simple.include I18n::Backend::Fallbacks--Rails.application.reloader.to_prepare do- # As we enabled +config.i18n.fallbacks+, Rails will fall back- # to the default locale.- # When other locales are available, fall back to them.- if Setting.table_exists? # don't want to prevent migrations- defaults = Set.new(I18n.fallbacks.defaults + Redmine::I18n.valid_languages.map(&:to_sym))- I18n.fallbacks.defaults = defaults- end-end