UNPKG

@crowdin/app-project-module

Version:

Module that generates for you all common endpoints for serving standalone Crowdin App

42 lines (41 loc) 1.21 kB
import Crowdin, { SourceStringsModel } from '@crowdin/crowdin-api-client'; import { CrowdinContextInfo, FileStore, ModuleKey } from '../../types'; export interface CustomMTLogic extends ModuleKey { withContext?: boolean; splitStringsIntoChunks?: boolean; batchSize?: number; maskEntities?: boolean; filesFolder?: string; translate: (options: { client: Crowdin; context: CrowdinContextInfo; projectId: number | null; source: string; target: string; strings: CustomMtString[]; }) => Promise<string[]>; validate?: (client: Crowdin) => Promise<void>; storeFile?: (fileContent: Buffer) => Promise<string>; } export interface CustomMTRequest { strings?: CustomMtString[]; stringsUrl?: string; } export interface CustomMTHandleOptions { baseUrl: string; folder: string; config: CustomMTLogic; fileStore?: FileStore; } export type CustomMtString = string | { id: number; projectId: number; fileId: number; identifier: string; context: string; maxLength: number; isHidden: boolean; text: string | SourceStringsModel.PluralText; isPlural: boolean; pluralForm: any; };