export interface PullOptions { /** * Filter assets by comma-separated tag names. Match any tag with `*` and negate tags by prefixing with `!`. * @see https://localise.biz/api/docs/export/exportall#query */ filter?: string; /** * Fallback locale for untranslated assets, specified as short code. e.g. en or en_GB. * @see https://localise.biz/api/docs/export/exportall#query */ fallback?: string; /** * Export translations according to asset order. * @see https://localise.biz/api/docs/export/exportall#query */ order?: 'created' | 'id'; /** * Export translations with a specific status or flag. Negate values by prefixing with !. e.g. "translated", or "!fuzzy". * @see https://localise.biz/api/docs/export/exportall#query */ status?: string; /** * Specify preferred character encoding. Alternative to Accept-Charset header but accepts a single value which must be valid. * @see https://localise.biz/api/docs/export/exportall#query */ charset?: string; /** * Force platform-specific line-endings. Default is Unix (LF) breaks. * @see https://localise.biz/api/docs/export/exportall#query */ breaks?: 'Unix' | 'DOS' | 'Mac'; } export interface PushOptions { /** * Upload all locales in a single request using the multi-locale import endpoint. * Uses /import/json?locale=auto&format=multi instead of per-locale uploads. */ experimentalPushAll?: boolean; /** * Specify that new assets will NOT be added to the project. * @see https://localise.biz/api/docs/import/import#query */ 'ignore-new'?: boolean; /** * Specify that existing assets encountered in the file will NOT be updated. * @see https://localise.biz/api/docs/import/import#query */ 'ignore-existing'?: boolean; /** * Specify that blank translations should NOT be imported. * @see https://localise.biz/api/docs/import/import#query */ 'ignore-blank'?: boolean; /** * Tag any NEW assets added during the import with the given tags (comma separated). * @see https://localise.biz/api/docs/import/import#query */ 'tag-new'?: string; /** * Tag ALL assets in the file with the given tags (comma separated). * @see https://localise.biz/api/docs/import/import#query */ 'tag-all'?: string; /** * Remove existing tags from any assets matched in the imported file (comma separated). * @see https://localise.biz/api/docs/import/import#query */ 'untag-all'?: string; /** * Tag existing assets that are MODIFIED by this import. * @see https://localise.biz/api/docs/import/import#query */ 'tag-updated'?: string; /** * Remove existing tags from assets that are MODIFIED during import. * @see https://localise.biz/api/docs/import/import#query */ 'untag-updated'?: string; /** * Tag existing assets in the project that are NOT found in the imported file. * @see https://localise.biz/api/docs/import/import#query */ 'tag-absent'?: string; /** * Remove existing tags from assets NOT found in the imported file. * @see https://localise.biz/api/docs/import/import#query */ 'untag-absent'?: string; /** * Permanently DELETES project assets NOT found in the file (use with extreme caution). * @see https://localise.biz/api/docs/import/import#query */ 'delete-absent'?: boolean; /** * Set this flag on any NEW (non-empty) translations imported into the current locale. * @see https://localise.biz/api/docs/import/import#query */ 'flag-new'?: string; /** * Set this flag on any translations MODIFIED during import to the current locale. * @see https://localise.biz/api/docs/import/import#query */ 'flag-updated'?: string; } export interface Config { /** * The API key of the Loco project you wish to sync to/from. * You can find this in the Loco project under `Developer * Tools › API Keys › Full Access Key` (if you do not * intend to use `loco-cli push`, an `Export key` will * work too). */ accessKey: string; /** * The folder in which the JSON translation files are * stored (defaults to current working dir). */ localesDir: string; /** @deprecated since v2 all languages are used */ defaultLanguage?: string; /** * Organize translations into namespaces (default: `false`). * Set this flag to `true` when dividing translations into * multiple files. The uploaded asset ID's will be * prefixed with `:`. */ namespaces: boolean; /** * Maximum number of modified files to display (defaults to 20). */ maxFiles?: number; /** * Options for the `loco-cli push` command. */ push?: PushOptions; /** * Options for the `loco-cli pull` command. */ pull?: PullOptions; } export type Locale = string; /** Recursive type for nested translation values */ export interface TranslationValue { [key: string]: string | TranslationValue; } export type Translations = Record; /** Flattened translations for API communication */ export type FlatTranslations = Record; /** Diff result that may contain undefined for deleted entries */ export type DiffRecord = Record; export type ProjectLocale = { code: string; }; /** Response shape from the Loco /import/json endpoint */ export interface ImportResponse { status: number; message: string; locales: ProjectLocale[]; }