forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular-translate.d.ts
105 lines (94 loc) · 4.79 KB
/
angular-translate.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Type definitions for Angular Translate v2.4.0 (pascalprecht.translate module)
// Project: https://github.com/PascalPrecht/angular-translate
// Definitions by: Michel Salib <https://github.com/michelsalib>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts" />
declare module angular.translate {
interface ITranslationTable {
[key: string]: string;
}
interface ILanguageKeyAlias {
[key: string]: string;
}
interface IStorage {
get(name: string): string;
set(name: string, value: string): void;
}
interface IStaticFilesLoaderOptions {
prefix: string;
suffix: string;
key?: string;
}
interface IPartialLoader<T> {
addPart(name : string, priority? : number) : T;
deletePart(name : string) : T;
isPartAvailable(name : string) : boolean;
}
interface ITranslatePartialLoaderService extends IPartialLoader<ITranslatePartialLoaderService> {
getRegisteredParts() : Array<string>;
isPartLoaded(name : string, lang : string) : boolean;
}
interface ITranslatePartialLoaderProvider extends angular.IServiceProvider, IPartialLoader<ITranslatePartialLoaderProvider> {
setPart(lang : string, part : string, table : ITranslationTable) : ITranslatePartialLoaderProvider;
}
interface ITranslateService {
(translationId: string, interpolateParams?: any, interpolationId?: string): angular.IPromise<string>;
(translationId: string[], interpolateParams?: any, interpolationId?: string): angular.IPromise<{ [key: string]: string }>;
cloakClassName(): string;
cloakClassName(name: string): ITranslateProvider;
fallbackLanguage(langKey?: string): string;
fallbackLanguage(langKey?: string[]): string;
instant(translationId: string, interpolateParams?: any, interpolationId?: string): string;
instant(translationId: string[], interpolateParams?: any, interpolationId?: string): { [key: string]: string };
isPostCompilingEnabled(): boolean;
preferredLanguage(langKey?: string): string;
proposedLanguage(): string;
refresh(langKey?: string): angular.IPromise<void>;
storage(): IStorage;
storageKey(): string;
use(): string;
use(key: string): angular.IPromise<string>;
useFallbackLanguage(langKey?: string): void;
versionInfo(): string;
loaderCache(): any;
}
interface ITranslateProvider extends angular.IServiceProvider {
translations(): ITranslationTable;
translations(key: string, translationTable: ITranslationTable): ITranslateProvider;
cloakClassName(): string;
cloakClassName(name: string): ITranslateProvider;
addInterpolation(factory: any): ITranslateProvider;
useMessageFormatInterpolation(): ITranslateProvider;
useInterpolation(factory: string): ITranslateProvider;
useSanitizeValueStrategy(value: string): ITranslateProvider;
preferredLanguage(): ITranslateProvider;
preferredLanguage(language: string): ITranslateProvider;
translationNotFoundIndicator(indicator: string): ITranslateProvider;
translationNotFoundIndicatorLeft(): string;
translationNotFoundIndicatorLeft(indicator: string): ITranslateProvider;
translationNotFoundIndicatorRight(): string;
translationNotFoundIndicatorRight(indicator: string): ITranslateProvider;
fallbackLanguage(): ITranslateProvider;
fallbackLanguage(language: string): ITranslateProvider;
fallbackLanguage(languages: string[]): ITranslateProvider;
use(): string;
use(key: string): ITranslateProvider;
storageKey(): string;
storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here
useUrlLoader(url: string): ITranslateProvider;
useStaticFilesLoader(options: IStaticFilesLoaderOptions): ITranslateProvider;
useLoader(loaderFactory: string, options: any): ITranslateProvider;
useLocalStorage(): ITranslateProvider;
useCookieStorage(): ITranslateProvider;
useStorage(storageFactory: any): ITranslateProvider;
storagePrefix(): string;
storagePrefix(prefix: string): ITranslateProvider;
useMissingTranslationHandlerLog(): ITranslateProvider;
useMissingTranslationHandler(factory: string): ITranslateProvider;
usePostCompiling(value: boolean): ITranslateProvider;
determinePreferredLanguage(fn?: () => void): ITranslateProvider;
registerAvailableLanguageKeys(): string[];
registerAvailableLanguageKeys(languageKeys: string[], aliases?: ILanguageKeyAlias): ITranslateProvider;
useLoaderCache(cache?: any): ITranslateProvider;
}
}