In Transloco Keys Manager V9, the keysManager configuration object in TranslocoGlobalConfig has been restructured from a flat object into command-specific sections. This change ensures that configuration keys are only applied to the commands they are intended for (extract or find) and provides better TypeScript type safety.
Breaking Change
Every existing transloco.config.js that places command-specific keys at the top level of keysManager must be updated. Keys like output, replace, removeExtraKeys, addMissingKeys, or emitErrorOnExtraKeys must now be moved into their respective extract or find blocks.
New Configuration Structure
| Section | Purpose | Supported Keys |
|---|
| Shared | Read by both extract and find | input, langs, fileFormat, marker, defaultValue, sort, unflat, translationsPath |
extract | Specific to the extract command | output, replace, removeExtraKeys |
find | Specific to the find command | addMissingKeys, emitErrorOnExtraKeys |
Example Migration
Before (V8):
keysManager: {
input: 'src/assets/i18n',
output: 'src/assets/i18n/en.json',
addMissingKeys: true
}
After (V9):
keysManager: {
input: 'src/assets/i18n',
extract: {
output: 'src/assets/i18n/en.json'
},
find: {
addMissingKeys: true
}
}
keysManager: {
// read by both commands
input?: string | string[];
langs?: string[];
fileFormat?: 'json' | 'pot';
marker?: string;
defaultValue?: string;
sort?: boolean;
unflat?: boolean;
translationsPath?: string;
extract?: { output?: string; replace?: boolean; removeExtraKeys?: boolean };
find?: { addMissingKeys?: boolean; emitErrorOnExtraKeys?: boolean };
}