diff --git a/src/experiment/adapter/adapter.ts b/src/experiment/adapter/adapter.ts index 1e8c700..4c0852a 100644 --- a/src/experiment/adapter/adapter.ts +++ b/src/experiment/adapter/adapter.ts @@ -8,7 +8,12 @@ import {transform} from 'src/experiment/transform'; import {translate} from 'src/experiment/translate'; export function extract(content: string, options: ExtractOptions): ExtractOutput { - const {xliff, skeleton} = transform(content); + const {xliff, skeleton} = transform(content, { + showTokens: options.showTokens, + showMap: options.showMap, + showRawMap: options.showRawMap, + showVars: options.showVars, + }); xliff.setFile(options.originalFile); xliff.setSourceLanguage(`${options.source.language}-${options.source.locale}`); diff --git a/src/experiment/adapter/types.ts b/src/experiment/adapter/types.ts index 55b73e8..b876cfe 100644 --- a/src/experiment/adapter/types.ts +++ b/src/experiment/adapter/types.ts @@ -2,6 +2,7 @@ import countries from '@shellscape/i18n-iso-countries'; import languages from '@cospired/i18n-iso-languages'; import {Xliff} from 'src/experiment/xliff/xliff'; +import {TransformOptions} from 'src/experiment/transform'; const languagesList = languages.langs(); @@ -23,7 +24,7 @@ interface Experiment { useExperimentalParser: true; } -export type ExtractOptions = Experiment & TemplateOptions; +export type ExtractOptions = Experiment & TemplateOptions & TransformOptions; export type ExtractOutput = { skeleton: string; diff --git a/src/experiment/transform.ts b/src/experiment/transform.ts index 512f3a3..06c8da5 100644 --- a/src/experiment/transform.ts +++ b/src/experiment/transform.ts @@ -48,14 +48,14 @@ const SHOW_MAP = false; const SHOW_RAW_MAP = false; const SHOW_VARS = false; -interface Options { +export interface TransformOptions { showTokens?: boolean; showMap?: boolean; showRawMap?: boolean; showVars?: boolean; } -export function transform(content: string, options?: Options) { +export function transform(content: string, options?: TransformOptions) { const { showTokens = SHOW_TOKENS, showMap = SHOW_MAP,