@jsverse/transloco-keys-manager
Version:
Extract translatable keys from projects that uses Transloco
45 lines • 1.76 kB
JavaScript
let config;
export function setConfig(_config) {
config = _config;
}
export function getConfig() {
return config;
}
export function defaultConfig({ projectType = 'application', sourceRoot = 'src', } = {}) {
const isApp = projectType === 'application';
const input = `${sourceRoot}/${isApp ? 'app' : 'lib'}`;
const i18nPath = `${sourceRoot}/assets/i18n`;
return {
// The source directory for all files using the translation keys
input: [input],
// The target directory for all generated translation files
output: i18nPath,
// The language files to generate
langs: ['en'],
// The marker sign for dynamic values
marker: 't',
// Whether to sort the keys
sort: false,
/**
* Relevant only for the Extractor
*/
// The default value of a generated key
defaultValue: undefined,
// Replace the contents of a translation file (if it exists) with the generated one (default value is false, in which case files are merged)
replace: false,
// Remove missing keys from existing translation files
removeExtraKeys: false,
/**
* Relevant only for the Detective
*/
// Add missing keys that were found by the detective (default value is false)
addMissingKeys: false,
// Emit an error and exit the process if extra keys were found (defaults to `false`)
emitErrorOnExtraKeys: false,
// The path for the root translation files (for example: assets/i18n)
translationsPath: i18nPath,
// The translation files format (`json`, `pot`) default is `json`
fileFormat: 'json',
};
}
//# sourceMappingURL=config.js.map