UNPKG

@anchor-solutions-nl/translator-as

Version:
147 lines (146 loc) 3.61 kB
export declare const translationsBaseUrl = "https://us-central1-translatorapp-as.cloudfunctions.net/translations/v2"; export declare class DocumentLog { createdAt: Date; updatedAt: Date; updatedBy: string; } export interface IObjectMap<T> { [key: string]: T; } export interface LanguageSegmentsDoc { id?: string; segments: LanguageSegments; } export interface LabelPathMap { id: string; segments: IObjectMap<{ id?: string; translations: LabelTranslations; }>; } export interface SyncAuth { id?: string; appId: string; secretKey?: string; allowedDomains: string[]; allowLocalHost: boolean; } export declare enum LanguageTypes { en = 1, nl = 2, fr = 3, de = 4, it = 5 } export declare class Language { id?: LanguageTypes; name: string; flag: string; symbol: string; active?: boolean; } export declare type LabelTranslations = IObjectMap<IObjectMap<LanguageTranslation>>; export declare class LanguageSegment { id: string; lastId?: string; translations: LabelTranslations; constructor(id: string); } export declare type LanguageSegments = IObjectMap<LanguageSegment>; export interface LanguageSegmentsDoc { id?: string; segments: LanguageSegments; } export declare class LanguageEditor { id: string; fullname: string; picture: string; assignedLanguages: LanguageTypes[]; isAdmin: boolean; } export declare type LanguageEditors = IObjectMap<LanguageEditor>; export declare class LabelSegment { id: string; totalLabels: number; completed: number; dateAdded: Date; lastUpdated: Date; starred: boolean; } export interface ISupportedLanguage { id: LanguageTypes; active: boolean; } export declare class TranslatorApp { id?: string; name: string; supportedLanguages: ISupportedLanguage[]; segments: IObjectMap<LabelSegment>; editors: LanguageEditors; log?: DocumentLog; constructor(supportedLanguages: ISupportedLanguage[], name?: string); } export declare class Label { id?: string; values: { [key: number]: string; }; variables: IObjectMap<{ id: string; description: string; }>; label: string; segmentId: string; done: boolean; } export declare class LanguageTranslation { id: LanguageTypes; value: string; label?: string; segmentId?: string; appId?: string; variables: string[]; } export interface LabelPathMap { id: string; segments: IObjectMap<{ id?: string; translations: LabelTranslations; }>; } export interface SyncAuth { id?: string; appId: string; secretKey?: string; allowedDomains: string[]; allowLocalHost: boolean; } export interface ITranslatorConfigOptions { appId: string; secret?: string; sync: boolean; labelStore?: any; defaultLanguage?: string; } export interface ILabelsProvider { _translate(val: string, varMap?: IObjectMap<any>): string; [key: string]: any; } export interface IAddLabelResponse { movedToGlobal?: boolean; fromSegment?: string; label?: Label; intendedSegment?: string; } export interface ITranslationStore { [key: string]: { segment: LabelSegment; labels?: IObjectMap<Label>; }; } export interface IAppResponse { app: TranslatorApp; starredLabels?: Label[]; appLanguages: Language[]; syncAuth?: SyncAuth; }