Skip to content

Commit

Permalink
Merge pull request #166 from diplodoc-platform/rndnm/addDebugOptions
Browse files Browse the repository at this point in the history
Add debug options
  • Loading branch information
Feverqwe authored Aug 28, 2024
2 parents 6dd3b52 + abd6c5b commit cd7e1f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/experiment/adapter/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down
3 changes: 2 additions & 1 deletion src/experiment/adapter/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -23,7 +24,7 @@ interface Experiment {
useExperimentalParser: true;
}

export type ExtractOptions = Experiment & TemplateOptions;
export type ExtractOptions = Experiment & TemplateOptions & TransformOptions;

export type ExtractOutput = {
skeleton: string;
Expand Down
4 changes: 2 additions & 2 deletions src/experiment/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit cd7e1f8

Please sign in to comment.