kopia lustrzana https://github.com/wagtail/wagtail
Ensure the ngettext (JS) util emulates the Django global if not present
Follow up from #9617pull/9627/head
rodzic
0000ed88f7
commit
55f5cad7f2
client/src/utils
|
@ -30,8 +30,9 @@ describe('gettext', () => {
|
|||
});
|
||||
|
||||
describe('ngettext', () => {
|
||||
it('should return the first param if Django ngettext is not loaded', () => {
|
||||
expect(ngettext('One bird', 'Many birds', 2)).toEqual('One bird');
|
||||
it('should emulate the Django ngettext function if it is not loaded', () => {
|
||||
expect(ngettext('One bird', 'Many birds', 1)).toEqual('One bird');
|
||||
expect(ngettext('One bird', 'Many birds', 2)).toEqual('Many birds');
|
||||
});
|
||||
|
||||
it('should call the global Django util if loaded', () => {
|
||||
|
|
|
@ -48,7 +48,7 @@ export function ngettext(
|
|||
return djangoNgettext(singular, plural, count);
|
||||
}
|
||||
|
||||
return singular;
|
||||
return count === 1 ? singular : plural;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Ładowanie…
Reference in New Issue