diff --git a/app/assets/javascripts/darkswarm/i18n.js.coffee b/app/assets/javascripts/darkswarm/i18n.js.coffee index 857437a51d..15ee584400 100644 --- a/app/assets/javascripts/darkswarm/i18n.js.coffee +++ b/app/assets/javascripts/darkswarm/i18n.js.coffee @@ -1,12 +1,13 @@ # Declares the translation function t. # You can use t('login') in Javascript. window.t = (key, options = {}) -> - if I18n == undefined + unless 'I18n' of window console.log 'The I18n object is undefined. Cannot translate text.' return key + return key unless key of I18n text = I18n[key] - return key if text == undefined - text = text.split("%{#{name}}").join(value) for name, value of options + for name, value of options + text = text.split("%{#{name}}").join(value) text # Provides the translation function t on all scopes.