woaru
Version:
Universal Project Setup Autopilot - Analyze and automatically configure development tools for ANY programming language
61 lines • 1.45 kB
JavaScript
import { Command } from 'commander';
import { t } from '../config/i18n.js';
/**
* Extended Command class with i18n support for Just-in-Time translation
*/
export class I18nCommand extends Command {
i18nKeys = {};
/**
* Set i18n translation keys for this command
*/
setI18nKeys(keys) {
this.i18nKeys = { ...this.i18nKeys, ...keys };
return this;
}
/**
* Get the translated description
*/
getTranslatedDescription() {
if (this.i18nKeys.description) {
return t(this.i18nKeys.description);
}
return this.description() || '';
}
/**
* Get the translated purpose
*/
getTranslatedPurpose() {
if (this.i18nKeys.purpose) {
return t(this.i18nKeys.purpose);
}
return '';
}
/**
* Get the translated help text
*/
getTranslatedHelpText() {
if (this.i18nKeys.helpText) {
return t(this.i18nKeys.helpText);
}
return '';
}
/**
* Get all i18n keys for this command
*/
getI18nKeys() {
return this.i18nKeys;
}
/**
* Override createCommand to return I18nCommand instances
*/
createCommand(name) {
return new I18nCommand(name);
}
}
/**
* Create a new i18n-enabled command
*/
export function createI18nCommand(name) {
return new I18nCommand(name);
}
//# sourceMappingURL=I18nCommand.js.map