nest-translate
Version:
基于 nestjs 封装的翻译 API
25 lines (24 loc) • 787 B
TypeScript
import { ModuleMetadata } from '@nestjs/common/interfaces';
export interface ITranslateOptions {
appid: string;
secret: string;
}
export interface ITranslateAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
inject: any[];
useFactory: (...args: any[]) => ITranslateOptions;
}
declare type ILang = 'zh' | 'en' | 'yue' | 'wyw' | 'jp' | 'kor' | 'fra' | 'spa' | 'th' | 'ara' | 'ru' | 'pt' | 'de' | 'it' | 'el' | 'nl' | 'pl' | 'bul' | 'est' | 'dan' | 'fin' | 'cs' | 'rom' | 'slo' | 'swe' | 'hu' | 'cht' | 'vie';
export interface ITranslateApiConfig {
q: string;
from?: 'auto' | ILang;
to?: ILang;
}
export interface ITranslateBaiduResponse {
from: string;
to: string;
trans_result: {
src: string;
dst: string;
}[];
}
export {};