(refactor) rename working to draft
This commit is contained in:
parent
ac551b1824
commit
e41fc88d97
@ -63,7 +63,7 @@ export class ExtractTask implements TaskInterface {
|
||||
}
|
||||
|
||||
// merge extracted strings with existing
|
||||
const working = extracted.union(existing);
|
||||
const draft = extracted.union(existing);
|
||||
|
||||
if (existing.isEmpty()) {
|
||||
this.out(dim(`- ${outputPath}`));
|
||||
@ -72,7 +72,7 @@ export class ExtractTask implements TaskInterface {
|
||||
}
|
||||
|
||||
// Run collection through post processors
|
||||
const final = this.process(working, extracted, existing);
|
||||
const final = this.process(draft, extracted, existing);
|
||||
|
||||
// Save to file
|
||||
this.save(outputPath, final);
|
||||
@ -116,11 +116,11 @@ export class ExtractTask implements TaskInterface {
|
||||
/**
|
||||
* Run strings through configured post processors
|
||||
*/
|
||||
protected process(working: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection {
|
||||
protected process(draft: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection {
|
||||
this.postProcessors.forEach(postProcessor => {
|
||||
working = postProcessor.process(working, extracted, existing);
|
||||
draft = postProcessor.process(draft, extracted, existing);
|
||||
});
|
||||
return working;
|
||||
return draft;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,8 +5,8 @@ export class KeyAsDefaultValuePostProcessor implements PostProcessorInterface {
|
||||
|
||||
public name: string = 'KeyAsDefaultValue';
|
||||
|
||||
public process(working: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection {
|
||||
return working.map((key, val) => val === '' ? key : val);
|
||||
public process(draft: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection {
|
||||
return draft.map((key, val) => val === '' ? key : val);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,6 @@ export interface PostProcessorInterface {
|
||||
|
||||
name: string;
|
||||
|
||||
process(working: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection;
|
||||
process(draft: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection;
|
||||
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ export class PurgeObsoleteKeysPostProcessor implements PostProcessorInterface {
|
||||
|
||||
public name: string = 'PurgeObsoleteKeys';
|
||||
|
||||
public process(working: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection {
|
||||
return working.intersect(extracted);
|
||||
public process(draft: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection {
|
||||
return draft.intersect(extracted);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ export class SortByKeyPostProcessor implements PostProcessorInterface {
|
||||
|
||||
public name: string = 'SortByKey';
|
||||
|
||||
public process(working: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection {
|
||||
return working.sort();
|
||||
public process(draft: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection {
|
||||
return draft.sort();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user