Fortytools-Blog mit News zu Gebäudereinigung, Betreuungsdiensten, Alltagshilfe und andere Dienstleistern

Hier finden Sie aktuelle Informationen, Tipps und Tricks rund um Büro, Verwaltung, Einsatzplanung und mehr!

Workaround for Rails i18n bug

Currently, there is a very annoying bug in Rails (at least in 3, dunno about 2) which completely messes up your nice i18n setup in production environments. If you have set cache_classes set to true, all i18n strings in your model classes will fall back to the default locale (EN that is) because the i18n subsystem is not yet initialized when classes are loaded eagerly.

See this bug for reference. Although it is already fixed, it seems like it did not make its way into the recent Rails 3.0.4. release. Luckily, I can present you a workaround here :)

Simply put the following in your application.rb or the respective environment configuration:

# THIS IS A WORKAROUND FOR A I18N BUG IN RAILS!
# Only required when cache_classes is set to true
# See https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6353
config.before_eager_load do
 I18n.locale = :de
 I18n.load_path += Dir[Rails.root.join('config', 'locales', 'de.yml').to_s]
 I18n.reload!
end


Über den Autor

Bewertet mit durchschnittlich
4.3
Sternen von
47
Lesern.

Fortytools für Ihre Branche

No items found.

Testen Sie 30 Tage kostenlos und unverbindlich die smarte Online-Software für Betreuungsdienste und Gebäudereiniger!

Sie können Fortytools 30 Tage kostenlos und unverbindlich testen. Dabei stehen Ihnen alle Funktionen uneingeschränkt zur Verfügung.
Heute kostenlos testen!
Nutzerbewertung: 4,8 von 5 Sternen

Fortytools läuft komplett im Internet-Browser: Keine Software-Installation, keine Probleme mit Updates. Einfach Einloggen und fertig. Von jedem internetfähigen Gerät.

Kostenlos und unverbindlich testen
Professionelle Rechnungen schreiben
Kunden-Daten verwalten
Mitarbeiter-Daten verwalten
Aufgaben- und Terminplanung
Professionelle Angebote schreiben
Einsätze planen und Zeiten erfassen