|
@@ -1,22 +1,30 @@
|
|
|
-(function (globals) {
|
|
|
-
|
|
|
+(function(globals) {
|
|
|
+ 'use strict';
|
|
|
var django = globals.django || (globals.django = {});
|
|
|
|
|
|
- django.pluralidx = function (count) { return (count == 1) ? 0 : 1; };
|
|
|
+ django.pluralidx = function(count) { return (count === 1) ? 0 : 1; };
|
|
|
|
|
|
/* gettext identity library */
|
|
|
|
|
|
- django.gettext = function (msgid) { return msgid; };
|
|
|
- django.ngettext = function (singular, plural, count) { return (count == 1) ? singular : plural; };
|
|
|
- django.gettext_noop = function (msgid) { return msgid; };
|
|
|
- django.pgettext = function (context, msgid) { return msgid; };
|
|
|
- django.npgettext = function (context, singular, plural, count) { return (count == 1) ? singular : plural; };
|
|
|
+ django.gettext = function(msgid) { return msgid; };
|
|
|
+ django.ngettext = function(singular, plural, count) {
|
|
|
+ return (count === 1) ? singular : plural;
|
|
|
+ };
|
|
|
+ django.gettext_noop = function(msgid) { return msgid; };
|
|
|
+ django.pgettext = function(context, msgid) { return msgid; };
|
|
|
+ django.npgettext = function(context, singular, plural, count) {
|
|
|
+ return (count === 1) ? singular : plural;
|
|
|
+ };
|
|
|
|
|
|
- django.interpolate = function (fmt, obj, named) {
|
|
|
+ django.interpolate = function(fmt, obj, named) {
|
|
|
if (named) {
|
|
|
- return fmt.replace(/%\(\w+\)s/g, function(match){return String(obj[match.slice(2,-2)])});
|
|
|
+ return fmt.replace(/%\(\w+\)s/g, function(match) {
|
|
|
+ return String(obj[match.slice(2, -2)]);
|
|
|
+ });
|
|
|
} else {
|
|
|
- return fmt.replace(/%s/g, function(match){return String(obj.shift())});
|
|
|
+ return fmt.replace(/%s/g, function(match) {
|
|
|
+ return String(obj.shift());
|
|
|
+ });
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -60,9 +68,9 @@
|
|
|
"YEAR_MONTH_FORMAT": "F Y"
|
|
|
};
|
|
|
|
|
|
- django.get_format = function (format_type) {
|
|
|
+ django.get_format = function(format_type) {
|
|
|
var value = django.formats[format_type];
|
|
|
- if (typeof(value) == 'undefined') {
|
|
|
+ if (typeof value === 'undefined') {
|
|
|
return format_type;
|
|
|
} else {
|
|
|
return value;
|