forked from discourse/discourse
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: Activate account page JS error with I18n
- Loading branch information
Showing
1 changed file
with
17 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
(function() { | ||
var oldI18nlookup = I18n.lookup; | ||
I18n.lookup = function(scope, options) { | ||
return oldI18nlookup.apply(this, ["js." + scope, options]); | ||
}; | ||
|
||
// Default format for storage units | ||
var oldI18ntoHumanSize = I18n.toHumanSize; | ||
I18n.toHumanSize = function(number, options) { | ||
options = options || {}; | ||
options.format = I18n.t("number.human.storage_units.format"); | ||
return oldI18ntoHumanSize.apply(this, [number, options]); | ||
}; | ||
if (typeof I18n !== "undefined") { | ||
var oldI18nlookup = I18n.lookup; | ||
I18n.lookup = function(scope, options) { | ||
return oldI18nlookup.apply(this, ["js." + scope, options]); | ||
}; | ||
|
||
if (Ember.EXTEND_PROTOTYPES) { | ||
String.prototype.i18n = function(options) { | ||
return I18n.t(String(this), options); | ||
// Default format for storage units | ||
var oldI18ntoHumanSize = I18n.toHumanSize; | ||
I18n.toHumanSize = function(number, options) { | ||
options = options || {}; | ||
options.format = I18n.t("number.human.storage_units.format"); | ||
return oldI18ntoHumanSize.apply(this, [number, options]); | ||
}; | ||
|
||
if (Ember.EXTEND_PROTOTYPES) { | ||
String.prototype.i18n = function(options) { | ||
return I18n.t(String(this), options); | ||
}; | ||
} | ||
} | ||
})(); |