mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Update index.d.ts Member "locale" of interface "JsonDataHeader" was renamed to "language". * Update gettext.js-tests.ts Updated test according to type definition changes. * Updated version number to 0.8
22 lines
499 B
TypeScript
22 lines
499 B
TypeScript
import * as Gettext from 'gettext.js';
|
|
|
|
const json: Gettext.JsonData = {
|
|
"": {
|
|
language: "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');
|
|
}
|