DefinitelyTyped/types/gettext.js/gettext.js-tests.ts
Andy b6c343f2b3 Apply new lint rules to yet more packages (#15548)
* Apply new lint rules to yet more packages

* Fix leaflet lint
2017-03-31 11:01:26 -07:00

22 lines
497 B
TypeScript

import * as Gettext from 'gettext.js';
const json: Gettext.JsonData = {
"": {
locale: "fr",
"plural-forms": "nplurals=2; plural=n>1;"
},
Welcome: "Bienvenue",
"There is %1 apple": [
"Il y a %1 pomme",
"Il y a %1 pommes"
]
};
const instance: Gettext.Gettext = Gettext.i18n();
instance.loadJSON(json, 'messages');
instance.setLocale('fr');
if (instance.ngettext('There is %1 apple', 'There are %1 apples', 0) === 'Il y a %1 pomme') {
throw new Error('Failed test');
}