mirror of
https://github.com/django/django.git
synced 2025-06-05 11:39:13 +00:00
Fixed #35278 -- Fixed returning possibly undefined from and functions.
This commit is contained in:
parent
c4df2a7776
commit
76f4b0c0f3
@ -33,7 +33,13 @@
|
|||||||
if (typeof value === 'undefined') {
|
if (typeof value === 'undefined') {
|
||||||
return msgid;
|
return msgid;
|
||||||
} else {
|
} else {
|
||||||
return (typeof value === 'string') ? value : value[0];
|
if (typeof value === 'string') {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
const text = value[0];
|
||||||
|
|
||||||
|
return typeof text === 'string' ? text : msgid;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -42,7 +48,17 @@
|
|||||||
if (typeof value === 'undefined') {
|
if (typeof value === 'undefined') {
|
||||||
return (count == 1) ? singular : plural;
|
return (count == 1) ? singular : plural;
|
||||||
} else {
|
} else {
|
||||||
return value.constructor === Array ? value[django.pluralidx(count)] : value;
|
if (value.constructor === Array) {
|
||||||
|
const text = value[django.pluralidx(count)];
|
||||||
|
|
||||||
|
if (typeof text === 'undefined') {
|
||||||
|
return (count == 1) ? singular : plural;
|
||||||
|
} else {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user