UNPKG

@crowdin/app-project-module

Version:

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

36 lines (35 loc) 1.16 kB
/// <reference types="node" /> /// <reference types="node" /> import Crowdin, { SourceStringsModel } from '@crowdin/crowdin-api-client'; import { CrowdinContextInfo, ModuleKey } from '../../types'; export interface CustomMTLogic extends ModuleKey { withContext?: boolean; splitStringsIntoChunks?: boolean; batchSize?: number; maskEntities?: boolean; filesFolder?: string; translate: (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; } 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; };