Skip to content

Commit 3387853

Browse files
Undid i18n and inquirer changes
1 parent 111ef04 commit 3387853

99 files changed

Lines changed: 1028 additions & 1093 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

types/i18n-abide/i18n-abide-tests.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import * as i18n from "i18n-abide";
1+
import * as i18n from 'i18n-abide';
22

33
const emptyAbideOptions: i18n.AbideOptions = {};
44
const fullAbideOptions: i18n.AbideOptions = {
5-
gettext_alias: "gettext",
6-
supported_languages: ["en-US"],
7-
default_lang: "en-US",
8-
debug_lang: "it-CH",
5+
gettext_alias: 'gettext',
6+
supported_languages: ['en-US'],
7+
default_lang: 'en-US',
8+
debug_lang: 'it-CH',
99
disable_locale_check: false,
10-
translation_directory: "l18n/",
10+
translation_directory: 'l18n/',
1111
logger: { warn(msg: string) {}, error(msg: string) {} },
1212
};
1313

@@ -17,7 +17,7 @@ i18n.abide(fullAbideOptions); // $ExpectType RequestHandler<ParamsDictionary, an
1717

1818
i18n.parseAcceptLanguage(""); // $ExpectType { lang: string; quality: number; }[]
1919

20-
i18n.bestLanguage([{ lang: "en-US", quality: 1.0 }], ["en-US"], "en-US"); // $ExpectType string
20+
i18n.bestLanguage([{lang: 'en-US', quality: 1.0}], ['en-US'], 'en-US'); // $ExpectType string
2121

2222
i18n.localeFrom(); // $ExpectType string
2323
i18n.localeFrom(""); // $ExpectType string

types/i18n-abide/index.d.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,11 @@
44
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
55
// TypeScript Version: 2.3
66

7-
import { RequestHandler } from "express";
7+
import { RequestHandler } from 'express';
88

99
export function abide(options?: AbideOptions): RequestHandler;
10-
export function parseAcceptLanguage(header?: string): Array<{ lang: string; quality: number }>;
11-
export function bestLanguage(
12-
languages: Array<{ lang: string; quality: number }>,
13-
supported_languages: string[],
14-
defaultLanguage: string,
15-
): string;
10+
export function parseAcceptLanguage(header?: string): Array<{ lang: string, quality: number }>;
11+
export function bestLanguage(languages: Array<{ lang: string, quality: number}>, supported_languages: string[], defaultLanguage: string): string;
1612
export function localeFrom(language?: string): string;
1713
export function languageFrom(locale?: string): string;
1814
export function normalizeLanguage(language?: string): string;
@@ -27,5 +23,5 @@ export interface AbideOptions {
2723
debug_lang?: string | undefined;
2824
disable_locale_check?: boolean | undefined;
2925
translation_directory?: string | undefined;
30-
logger?: { warn(msg: string): void; error(msg: string): void } | undefined;
26+
logger?: { warn(msg: string): void, error(msg: string): void } | undefined;
3127
}

types/i18n-js/i18n-js-tests.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ I18n.t("some.missing.scope", { defaultValue: "A default message" });
1616
I18n.t("noun", { defaultValue: "I'm a {{noun}}", noun: "Mac" });
1717
I18n.t("some.missing.scope", { defaults: [{ scope: "some.existing.scope" }] });
1818
I18n.t("some.missing.scope", { defaults: [{ message: "Some message" }] });
19-
I18n.translate("message", { defaultValue: { one: "%{count} message", other: "%{count} messages" }, count: 1 });
19+
I18n.translate("message", {defaultValue: { one: "%{count} message", other: "%{count} messages"}, count: 1});
2020
I18n.translate("foo", {
21-
defaults: [{ scope: "bar" }],
21+
defaults: [{scope: "bar"}],
2222
defaultValue: (scope: string) => scope.toUpperCase(),
2323
});
2424

2525
I18n.fallbacks = true;
2626
I18n.fallbacks = "de";
2727
I18n.fallbacks = {
2828
de: "en",
29-
"de-DE": ["de", "en"],
29+
"de-DE": [ "de", "en" ]
3030
};
3131
I18n.locales.no = ["nb", "en"];
3232
I18n.locales.no = "nb";
@@ -45,13 +45,14 @@ I18n.missingTranslation = (scope, options) => undefined;
4545

4646
I18n.t("inbox.counting", { count: 10 });
4747
I18n.pluralization["ru"] = count => {
48-
const key = count % 10 === 1 && count % 100 !== 11
49-
? "one"
50-
: [2, 3, 4].indexOf(count % 10) >= 0 && [12, 13, 14].indexOf(count % 100) < 0
51-
? "few"
52-
: count % 10 === 0 || [5, 6, 7, 8, 9].indexOf(count % 10) >= 0 || [11, 12, 13, 14].indexOf(count % 100) >= 0
53-
? "many"
54-
: "other";
48+
const key =
49+
count % 10 === 1 && count % 100 !== 11
50+
? "one"
51+
: [2, 3, 4].indexOf(count % 10) >= 0 && [12, 13, 14].indexOf(count % 100) < 0
52+
? "few"
53+
: count % 10 === 0 || [5, 6, 7, 8, 9].indexOf(count % 10) >= 0 || [11, 12, 13, 14].indexOf(count % 100) >= 0
54+
? "many"
55+
: "other";
5556
return [key];
5657
};
5758

@@ -74,7 +75,7 @@ I18n.toNumber(1000, { delimiter: ".", precision: 0 });
7475
I18n.toCurrency(1000, { precision: 0 });
7576

7677
I18n.toHumanSize(1234);
77-
I18n.toHumanSize(1024 * 1024, { scope: "extended" });
78+
I18n.toHumanSize(1024 * 1024, {scope: "extended"});
7879

7980
I18n.l("date.formats.short", "2009-09-18");
8081
I18n.l("time.formats.short", "2009-09-18 23:12:43");

types/i18n-js/index.d.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,12 @@ declare namespace I18n {
2424
// eslint-disable-next-line @definitelytyped/prefer-declare-function
2525
let missingTranslation: (scope: string, options?: TranslateOptions) => string | null | undefined;
2626
// eslint-disable-next-line @definitelytyped/prefer-declare-function
27-
let missingPlaceholder: (
28-
placeholder: string,
29-
message: string,
30-
options?: InterpolateOptions,
31-
) => string | null | undefined;
27+
let missingPlaceholder: (placeholder: string, message: string, options?: InterpolateOptions) => string | null | undefined;
3228
// eslint-disable-next-line @definitelytyped/prefer-declare-function
33-
let nullPlaceholder: (
34-
placeholder: string,
35-
message: string,
36-
options?: InterpolateOptions,
37-
) => string | null | undefined;
29+
let nullPlaceholder: (placeholder: string, message: string, options?: InterpolateOptions) => string | null | undefined;
3830

3931
let translations: { [locale: string]: object };
40-
let locales: {
41-
[key: string]: string | string[] | ((locale: string) => string | string[]);
42-
get: (locale: string) => string[];
43-
};
32+
let locales: { [key: string]: string | string[] | ((locale: string) => string | string[]), get: (locale: string) => string[] };
4433
let pluralization: { [locale: string]: (count: number) => string[] };
4534

4635
function reset(): void;

0 commit comments

Comments
 (0)