mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
Merge pull request #32772 from kiwigrid/i18n-__n-short-syntax
[i18n] Add short syntax to i18n.__n
This commit is contained in:
@@ -137,6 +137,16 @@ i18n.__({ phrase: 'Hello {{name}}', locale: 'fr' }, { name: 'Marcus' }); // Salu
|
||||
* __n()
|
||||
* https://github.com/mashpie/i18n-node#__n
|
||||
*/
|
||||
// short syntax
|
||||
// global (this.locale == 'de')
|
||||
i18n.__n("%s cat", 1); // 1 Katze
|
||||
i18n.__n("%s cat", 3); // 3 Katzen
|
||||
|
||||
// scoped via req object (req.locale == 'de')
|
||||
req.__n("%s cat", 1); // 1 Katze
|
||||
req.__n("%s cat", 3); // 3 Katzen
|
||||
|
||||
// long syntax
|
||||
// global (this.locale == 'de')
|
||||
i18n.__n("%s cat", "%s cats", 1); // 1 Katze
|
||||
i18n.__n("%s cat", "%s cats", 3); // 3 Katzen
|
||||
|
||||
Vendored
+16
@@ -192,6 +192,14 @@ declare namespace i18n {
|
||||
|
||||
//#region __n()
|
||||
|
||||
/**
|
||||
* Translate with plural condition the given phrase and count using locale configuration
|
||||
* @param phrase - Short phrase to be translated. All plural options ("one", "few", other", ...) have to be provided by your translation file
|
||||
* @param count - The number which allow to select from plural to singular
|
||||
* @returns The translated phrase
|
||||
*/
|
||||
function __n(phrase: string, count: number): string;
|
||||
|
||||
/**
|
||||
* Translate with plural condition the given phrase and count using locale configuration
|
||||
* @param options - Options for plural translate
|
||||
@@ -346,6 +354,14 @@ interface i18nAPI {
|
||||
|
||||
//#region __n()
|
||||
|
||||
/**
|
||||
* Translate with plural condition the given phrase and count using locale configuration
|
||||
* @param phrase - Short phrase to be translated. All plural options ("one", "few", other", ...) have to be provided by your translation file
|
||||
* @param count - The number which allow to select from plural to singular
|
||||
* @returns The translated phrase
|
||||
*/
|
||||
__n(phrase: string, count: number): string;
|
||||
|
||||
/**
|
||||
* Translate with plural condition the given phrase and count using locale configuration
|
||||
* @param options - Options for plural translate
|
||||
|
||||
Reference in New Issue
Block a user