From 7ca83917393214cae0f67bb1d6c38b0c6ade9d0d Mon Sep 17 00:00:00 2001 From: MrZYX Date: Tue, 1 Feb 2011 22:43:46 +0100 Subject: [PATCH] Javascript I18n: fallback to DEFAULT_LANGUAGE for missing keys --- app/controllers/application_controller.rb | 4 ---- app/helpers/application_helper.rb | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6b2df3bd6..9e00b9171 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -48,8 +48,4 @@ class ApplicationController < ActionController::Base I18n.locale = request.compatible_language_from AVAILABLE_LANGUAGE_CODES end end - - def get_javascript_strings_for(language) - Il8n.t('javascripts').to_json - end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9b1a47680..6d79922d3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -272,6 +272,8 @@ module ApplicationHelper def get_javascript_strings_for(language) - I18n.t('javascripts') + translations = I18n.t('javascripts', :locale => language) + defaults = I18n.t('javascripts', :locale => DEFAULT_LANGUAGE) + defaults.update(translations) end end