Commit 10eb4664 authored by Ivan Mazhukin's avatar Ivan Mazhukin

add russian extension localization

parent 67c3a8b4
...@@ -115,6 +115,8 @@ code --install-extension epm-docker-test-runner-0.1.0.vsix --force ...@@ -115,6 +115,8 @@ code --install-extension epm-docker-test-runner-0.1.0.vsix --force
## Настройки ## Настройки
Расширение поддерживает переключатель языка `epmDockerTest.language` со значениями `auto`, `en` и `ru`. В режиме `auto` runtime-интерфейс расширения следует языку интерфейса VS Code.
Основные настройки: Основные настройки:
- `epmDockerTest.scriptPath`: путь к `epm-docker-test.sh`; пустое значение означает автоопределение. - `epmDockerTest.scriptPath`: путь к `epm-docker-test.sh`; пустое значение означает автоопределение.
...@@ -122,6 +124,7 @@ code --install-extension epm-docker-test-runner-0.1.0.vsix --force ...@@ -122,6 +124,7 @@ code --install-extension epm-docker-test-runner-0.1.0.vsix --force
- `epmDockerTest.defaultSystems`: системы по умолчанию для запусков app/exec. - `epmDockerTest.defaultSystems`: системы по умолчанию для запусков app/exec.
- `epmDockerTest.defaultPreset`: пресет по умолчанию для запусков по пресету. - `epmDockerTest.defaultPreset`: пресет по умолчанию для запусков по пресету.
- `epmDockerTest.defaultMode`: `auto`, `local` или `remote`. - `epmDockerTest.defaultMode`: `auto`, `local` или `remote`.
- `epmDockerTest.language`: язык runtime-интерфейса расширения: `auto`, `en` или `ru`.
- `epmDockerTest.parallelJobs`: передавать `-j N`, если значение больше `1`. - `epmDockerTest.parallelJobs`: передавать `-j N`, если значение больше `1`.
- `epmDockerTest.eepmDir`: путь к дереву `eepm`, если оно не совпадает с рабочим каталогом. - `epmDockerTest.eepmDir`: путь к дереву `eepm`, если оно не совпадает с рабочим каталогом.
- `epmDockerTest.eepmSource`: источник `eepm`, например `local` или `builder64`. - `epmDockerTest.eepmSource`: источник `eepm`, например `local` или `builder64`.
......
...@@ -10,6 +10,55 @@ let lastRun = undefined; ...@@ -10,6 +10,55 @@ let lastRun = undefined;
let terminal = undefined; let terminal = undefined;
let extensionContext = undefined; let extensionContext = undefined;
let actionsProvider = undefined; let actionsProvider = undefined;
let statusItem = undefined;
const RUNTIME_MESSAGES_RU = {
'Run epm-docker-test.sh': 'Запустить epm-docker-test.sh',
'--latest for app tests': '--latest для app-тестов',
'Run app on systems': 'Запустить app на системах',
'Run app on systems parallel': 'Запустить app параллельно',
'Run app preset': 'Запустить app-пресет',
'Run exec command': 'Выполнить команду',
'Local EPM': 'Локальный EPM',
'Tools': 'Инструменты',
'Rerun last command': 'Повторить последнюю команду',
'Open log folder': 'Открыть каталог логов',
'Configure': 'Настроить',
'Local ./bin/epm play': 'Локально ./bin/epm play',
'Local ./bin/epm play --latest': 'Локально ./bin/epm play --latest',
'Local ./bin/epm remove': 'Локально ./bin/epm remove',
'Pass --latest to app test commands': 'Передавать --latest в команды app-тестов',
'Choose an epm-docker-test action': 'Выберите действие epm-docker-test',
'EPM Docker Test Parallel': 'EPM Docker Test: параллельно',
'Application name for epm play': 'Имя приложения для epm play',
'Preset: {preset}': 'Пресет: {preset}',
'Default preset': 'Пресет по умолчанию',
'Custom systems...': 'Свои системы...',
'Type target systems manually': 'Ввести целевые системы вручную',
'Choose preset or custom target systems': 'Выберите пресет или введите системы вручную',
'Shell command to run in the container': 'Shell-команда для запуска в контейнере',
'Systems': 'Системы',
'Type one or more target systems': 'Ввести одну или несколько целевых систем',
'Preset': 'Пресет',
'Use main, russian, or all': 'Использовать main, russian или all',
'Choose target type': 'Выберите тип цели',
'Target systems separated by spaces': 'Целевые системы через пробел',
'Application name for local ./bin/epm play': 'Имя приложения для локального ./bin/epm play',
'Local epm play': 'Локально epm play',
'Local epm play --latest': 'Локально epm play --latest',
'Local epm remove': 'Локально epm remove',
'Application name for local ./bin/epm remove': 'Имя приложения для локального ./bin/epm remove',
'Could not find local epm: {epm}': 'Не удалось найти локальный epm: {epm}',
'{prompt} (inferred from {source})': '{prompt} (определено из {source})',
'Cancel': 'Отмена',
'No epm-docker-test command has been run yet.': 'Команда epm-docker-test еще не запускалась.',
'Favorite must define either app or exec.': 'В избранной команде должен быть задан app или exec.',
'Test command must define systems or preset.': 'В тестовой команде должны быть заданы системы или пресет.',
'Choose a preset ({preset})': 'Выберите пресет ({preset})',
'Log folder does not exist yet: {logRoot}': 'Каталог логов еще не существует: {logRoot}',
'Open Parent': 'Открыть родительский каталог',
'Could not find epm-docker-test.sh. Set epmDockerTest.scriptPath.': 'Не удалось найти epm-docker-test.sh. Укажите epmDockerTest.scriptPath.'
};
function activate(context) { function activate(context) {
extensionContext = context; extensionContext = context;
...@@ -27,9 +76,10 @@ function activate(context) { ...@@ -27,9 +76,10 @@ function activate(context) {
}); });
const status = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 100); const status = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 100);
statusItem = status;
status.name = 'EPM Docker Test'; status.name = 'EPM Docker Test';
status.text = '$(beaker) EPM Test'; status.text = '$(beaker) EPM Test';
status.tooltip = 'Run epm-docker-test.sh'; refreshStatusItem();
status.command = 'epmDockerTest.runQuick'; status.command = 'epmDockerTest.runQuick';
status.show(); status.show();
...@@ -54,6 +104,7 @@ function activate(context) { ...@@ -54,6 +104,7 @@ function activate(context) {
vscode.commands.registerCommand('epmDockerTest.runFavorite', (favorite) => runFavorite(favorite)), vscode.commands.registerCommand('epmDockerTest.runFavorite', (favorite) => runFavorite(favorite)),
vscode.workspace.onDidChangeConfiguration((event) => { vscode.workspace.onDidChangeConfiguration((event) => {
if (event.affectsConfiguration(EXTENSION_ID)) { if (event.affectsConfiguration(EXTENSION_ID)) {
refreshStatusItem();
provider.refresh(); provider.refresh();
} }
}) })
...@@ -62,6 +113,30 @@ function activate(context) { ...@@ -62,6 +113,30 @@ function activate(context) {
function deactivate() {} function deactivate() {}
function t(message, values = {}) {
const template = runtimeLanguage() === 'ru'
? RUNTIME_MESSAGES_RU[message] || message
: message;
return template.replace(/\{(\w+)\}/g, (match, key) => (
Object.prototype.hasOwnProperty.call(values, key) ? String(values[key]) : match
));
}
function runtimeLanguage() {
const configured = getConfig().get('language', 'auto');
if (configured === 'en' || configured === 'ru') {
return configured;
}
return vscode.env.language.toLowerCase().startsWith('ru') ? 'ru' : 'en';
}
function refreshStatusItem() {
if (!statusItem) {
return;
}
statusItem.tooltip = t('Run epm-docker-test.sh');
}
class ActionsProvider { class ActionsProvider {
constructor() { constructor() {
this.emitter = new vscode.EventEmitter(); this.emitter = new vscode.EventEmitter();
...@@ -99,19 +174,19 @@ class ActionsProvider { ...@@ -99,19 +174,19 @@ class ActionsProvider {
)); ));
const builtIns = [ const builtIns = [
checkboxItem('--latest for app tests', this.latest), checkboxItem(t('--latest for app tests'), this.latest),
commandItem('Run app on systems', 'epmDockerTest.runApp', undefined, new vscode.ThemeIcon('run')), commandItem(t('Run app on systems'), 'epmDockerTest.runApp', undefined, new vscode.ThemeIcon('run')),
commandItem('Run app on systems parallel', 'epmDockerTest.runAppParallel', undefined, new vscode.ThemeIcon('run-all')), commandItem(t('Run app on systems parallel'), 'epmDockerTest.runAppParallel', undefined, new vscode.ThemeIcon('run-all')),
commandItem('Run app preset', 'epmDockerTest.runPreset', undefined, new vscode.ThemeIcon('list-selection')), commandItem(t('Run app preset'), 'epmDockerTest.runPreset', undefined, new vscode.ThemeIcon('list-selection')),
commandItem('Run exec command', 'epmDockerTest.runExec', undefined, new vscode.ThemeIcon('terminal')), commandItem(t('Run exec command'), 'epmDockerTest.runExec', undefined, new vscode.ThemeIcon('terminal')),
separatorItem('Local EPM'), separatorItem(t('Local EPM')),
commandItem('./bin/epm play <app>', 'epmDockerTest.runLocalPlay', undefined, new vscode.ThemeIcon('play')), commandItem('./bin/epm play <app>', 'epmDockerTest.runLocalPlay', undefined, new vscode.ThemeIcon('play')),
commandItem('./bin/epm play --latest <app>', 'epmDockerTest.runLocalPlayLatest', undefined, new vscode.ThemeIcon('cloud-download')), commandItem('./bin/epm play --latest <app>', 'epmDockerTest.runLocalPlayLatest', undefined, new vscode.ThemeIcon('cloud-download')),
commandItem('./bin/epm remove <app>', 'epmDockerTest.runLocalRemove', undefined, new vscode.ThemeIcon('trash')), commandItem('./bin/epm remove <app>', 'epmDockerTest.runLocalRemove', undefined, new vscode.ThemeIcon('trash')),
separatorItem('Tools'), separatorItem(t('Tools')),
commandItem('Rerun last command', 'epmDockerTest.rerunLast', undefined, new vscode.ThemeIcon('debug-restart')), commandItem(t('Rerun last command'), 'epmDockerTest.rerunLast', undefined, new vscode.ThemeIcon('debug-restart')),
commandItem('Open log folder', 'epmDockerTest.openLogs', undefined, new vscode.ThemeIcon('folder-opened')), commandItem(t('Open log folder'), 'epmDockerTest.openLogs', undefined, new vscode.ThemeIcon('folder-opened')),
commandItem('Configure', 'epmDockerTest.configure', undefined, new vscode.ThemeIcon('settings-gear')) commandItem(t('Configure'), 'epmDockerTest.configure', undefined, new vscode.ThemeIcon('settings-gear'))
]; ];
return [...favoriteItems, ...builtIns]; return [...favoriteItems, ...builtIns];
...@@ -141,24 +216,24 @@ function checkboxItem(label, checked) { ...@@ -141,24 +216,24 @@ function checkboxItem(label, checked) {
item.checkboxState = checked item.checkboxState = checked
? vscode.TreeItemCheckboxState.Checked ? vscode.TreeItemCheckboxState.Checked
: vscode.TreeItemCheckboxState.Unchecked; : vscode.TreeItemCheckboxState.Unchecked;
item.tooltip = 'Pass --latest to app test commands'; item.tooltip = t('Pass --latest to app test commands');
item.iconPath = new vscode.ThemeIcon('cloud-download'); item.iconPath = new vscode.ThemeIcon('cloud-download');
return item; return item;
} }
async function runQuick() { async function runQuick() {
const choice = await vscode.window.showQuickPick([ const choice = await vscode.window.showQuickPick([
{ label: '$(run) Run app on systems', command: 'epmDockerTest.runApp' }, { label: `$(run) ${t('Run app on systems')}`, command: 'epmDockerTest.runApp' },
{ label: '$(run-all) Run app on systems parallel', command: 'epmDockerTest.runAppParallel' }, { label: `$(run-all) ${t('Run app on systems parallel')}`, command: 'epmDockerTest.runAppParallel' },
{ label: '$(list-selection) Run app preset', command: 'epmDockerTest.runPreset' }, { label: `$(list-selection) ${t('Run app preset')}`, command: 'epmDockerTest.runPreset' },
{ label: '$(terminal) Run exec command', command: 'epmDockerTest.runExec' }, { label: `$(terminal) ${t('Run exec command')}`, command: 'epmDockerTest.runExec' },
{ label: '$(play) Local ./bin/epm play', command: 'epmDockerTest.runLocalPlay' }, { label: `$(play) ${t('Local ./bin/epm play')}`, command: 'epmDockerTest.runLocalPlay' },
{ label: '$(cloud-download) Local ./bin/epm play --latest', command: 'epmDockerTest.runLocalPlayLatest' }, { label: `$(cloud-download) ${t('Local ./bin/epm play --latest')}`, command: 'epmDockerTest.runLocalPlayLatest' },
{ label: '$(trash) Local ./bin/epm remove', command: 'epmDockerTest.runLocalRemove' }, { label: `$(trash) ${t('Local ./bin/epm remove')}`, command: 'epmDockerTest.runLocalRemove' },
{ label: '$(debug-restart) Rerun last command', command: 'epmDockerTest.rerunLast' }, { label: `$(debug-restart) ${t('Rerun last command')}`, command: 'epmDockerTest.rerunLast' },
{ label: '$(folder-opened) Open log folder', command: 'epmDockerTest.openLogs' } { label: `$(folder-opened) ${t('Open log folder')}`, command: 'epmDockerTest.openLogs' }
], { ], {
placeHolder: 'Choose an epm-docker-test action' placeHolder: t('Choose an epm-docker-test action')
}); });
if (choice) { if (choice) {
...@@ -168,8 +243,8 @@ async function runQuick() { ...@@ -168,8 +243,8 @@ async function runQuick() {
async function runApp(parallel) { async function runApp(parallel) {
const app = await promptForApp({ const app = await promptForApp({
title: parallel ? 'EPM Docker Test Parallel' : 'EPM Docker Test', title: parallel ? t('EPM Docker Test Parallel') : 'EPM Docker Test',
prompt: 'Application name for epm play', prompt: t('Application name for epm play'),
fallbackKey: 'lastApp' fallbackKey: 'lastApp'
}); });
if (!app) { if (!app) {
...@@ -195,7 +270,7 @@ async function runApp(parallel) { ...@@ -195,7 +270,7 @@ async function runApp(parallel) {
const systems = await promptForSystems({ const systems = await promptForSystems({
title: 'EPM Docker Test', title: 'EPM Docker Test',
prompt: 'Target systems separated by spaces', prompt: t('Target systems separated by spaces'),
fallback: getWorkspaceState('lastSystems', getConfig().get('defaultSystems', 'fedora')) fallback: getWorkspaceState('lastSystems', getConfig().get('defaultSystems', 'fedora'))
}); });
if (!systems) { if (!systems) {
...@@ -212,28 +287,28 @@ async function pickParallelTarget() { ...@@ -212,28 +287,28 @@ async function pickParallelTarget() {
const presetItems = ['main', 'russian', 'all'] const presetItems = ['main', 'russian', 'all']
.filter((preset) => preset !== defaultPreset) .filter((preset) => preset !== defaultPreset)
.map((preset) => ({ .map((preset) => ({
label: `$(list-selection) Preset: ${preset}`, label: `$(list-selection) ${t('Preset: {preset}', { preset })}`,
preset preset
})); }));
const choice = await vscode.window.showQuickPick([ const choice = await vscode.window.showQuickPick([
{ {
label: `$(list-selection) Preset: ${defaultPreset}`, label: `$(list-selection) ${t('Preset: {preset}', { preset: defaultPreset })}`,
description: 'Default preset', description: t('Default preset'),
preset: defaultPreset preset: defaultPreset
}, },
...presetItems, ...presetItems,
{ {
label: '$(edit) Custom systems...', label: `$(edit) ${t('Custom systems...')}`,
description: 'Type target systems manually', description: t('Type target systems manually'),
custom: true custom: true
}, },
{ {
label: '$(close) Отмена', label: `$(close) ${t('Cancel')}`,
cancel: true cancel: true
} }
], { ], {
title: 'EPM Docker Test Parallel', title: t('EPM Docker Test Parallel'),
placeHolder: 'Choose preset or custom target systems' placeHolder: t('Choose preset or custom target systems')
}); });
if (!choice || choice.cancel) { if (!choice || choice.cancel) {
...@@ -244,8 +319,8 @@ async function pickParallelTarget() { ...@@ -244,8 +319,8 @@ async function pickParallelTarget() {
} }
const systems = await promptForSystems({ const systems = await promptForSystems({
title: 'EPM Docker Test Parallel', title: t('EPM Docker Test Parallel'),
prompt: 'Target systems separated by spaces', prompt: t('Target systems separated by spaces'),
fallback: getWorkspaceState('lastSystems', getConfig().get('defaultSystems', 'fedora')) fallback: getWorkspaceState('lastSystems', getConfig().get('defaultSystems', 'fedora'))
}); });
return systems ? { systems } : undefined; return systems ? { systems } : undefined;
...@@ -254,7 +329,7 @@ async function pickParallelTarget() { ...@@ -254,7 +329,7 @@ async function pickParallelTarget() {
async function runPreset() { async function runPreset() {
const app = await promptForApp({ const app = await promptForApp({
title: 'EPM Docker Test', title: 'EPM Docker Test',
prompt: 'Application name for epm play', prompt: t('Application name for epm play'),
fallbackKey: 'lastApp' fallbackKey: 'lastApp'
}); });
if (!app) { if (!app) {
...@@ -273,7 +348,7 @@ async function runPreset() { ...@@ -273,7 +348,7 @@ async function runPreset() {
async function runExec() { async function runExec() {
const exec = await vscode.window.showInputBox({ const exec = await vscode.window.showInputBox({
title: 'EPM Docker Test', title: 'EPM Docker Test',
prompt: 'Shell command to run in the container', prompt: t('Shell command to run in the container'),
placeHolder: 'cat /etc/os-release | head -3', placeHolder: 'cat /etc/os-release | head -3',
value: getWorkspaceState('lastExec', '') value: getWorkspaceState('lastExec', '')
}); });
...@@ -282,11 +357,11 @@ async function runExec() { ...@@ -282,11 +357,11 @@ async function runExec() {
} }
const targetKind = await vscode.window.showQuickPick([ const targetKind = await vscode.window.showQuickPick([
{ label: 'Systems', description: 'Type one or more target systems' }, { label: t('Systems'), target: 'systems', description: t('Type one or more target systems') },
{ label: 'Preset', description: 'Use main, russian, or all' } { label: t('Preset'), target: 'preset', description: t('Use main, russian, or all') }
], { ], {
title: 'EPM Docker Test', title: 'EPM Docker Test',
placeHolder: 'Choose target type' placeHolder: t('Choose target type')
}); });
if (!targetKind) { if (!targetKind) {
return; return;
...@@ -294,7 +369,7 @@ async function runExec() { ...@@ -294,7 +369,7 @@ async function runExec() {
await setWorkspaceState('lastExec', exec); await setWorkspaceState('lastExec', exec);
if (targetKind.label === 'Preset') { if (targetKind.target === 'preset') {
const preset = await pickPreset(getConfig().get('defaultPreset', 'main')); const preset = await pickPreset(getConfig().get('defaultPreset', 'main'));
if (preset) { if (preset) {
await executeTest({ exec, preset }); await executeTest({ exec, preset });
...@@ -304,7 +379,7 @@ async function runExec() { ...@@ -304,7 +379,7 @@ async function runExec() {
const systems = await promptForSystems({ const systems = await promptForSystems({
title: 'EPM Docker Test', title: 'EPM Docker Test',
prompt: 'Target systems separated by spaces', prompt: t('Target systems separated by spaces'),
fallback: getWorkspaceState('lastSystems', getConfig().get('defaultSystems', 'fedora')) fallback: getWorkspaceState('lastSystems', getConfig().get('defaultSystems', 'fedora'))
}); });
if (systems) { if (systems) {
...@@ -318,14 +393,14 @@ async function runLocalPlay(latest) { ...@@ -318,14 +393,14 @@ async function runLocalPlay(latest) {
const epm = path.join(eepmRoot, 'bin', 'epm'); const epm = path.join(eepmRoot, 'bin', 'epm');
if (!fs.existsSync(epm)) { if (!fs.existsSync(epm)) {
vscode.window.showErrorMessage(`Could not find local epm: ${epm}`); vscode.window.showErrorMessage(t('Could not find local epm: {epm}', { epm }));
return; return;
} }
const inferred = inferAppFromActiveEditor(eepmRoot); const inferred = inferAppFromActiveEditor(eepmRoot);
const app = await promptForApp({ const app = await promptForApp({
title: latest ? 'Local epm play --latest' : 'Local epm play', title: latest ? t('Local epm play --latest') : t('Local epm play'),
prompt: 'Application name for local ./bin/epm play', prompt: t('Application name for local ./bin/epm play'),
fallbackKey: 'lastLocalApp', fallbackKey: 'lastLocalApp',
inferred inferred
}); });
...@@ -359,14 +434,14 @@ async function runLocalRemove() { ...@@ -359,14 +434,14 @@ async function runLocalRemove() {
const epm = path.join(eepmRoot, 'bin', 'epm'); const epm = path.join(eepmRoot, 'bin', 'epm');
if (!fs.existsSync(epm)) { if (!fs.existsSync(epm)) {
vscode.window.showErrorMessage(`Could not find local epm: ${epm}`); vscode.window.showErrorMessage(t('Could not find local epm: {epm}', { epm }));
return; return;
} }
const inferred = inferAppFromActiveEditor(eepmRoot); const inferred = inferAppFromActiveEditor(eepmRoot);
const app = await promptForApp({ const app = await promptForApp({
title: 'Local epm remove', title: t('Local epm remove'),
prompt: 'Application name for local ./bin/epm remove', prompt: t('Application name for local ./bin/epm remove'),
fallbackKey: 'lastLocalApp', fallbackKey: 'lastLocalApp',
inferred inferred
}); });
...@@ -402,7 +477,7 @@ async function promptForApp(options) { ...@@ -402,7 +477,7 @@ async function promptForApp(options) {
return vscode.window.showInputBox({ return vscode.window.showInputBox({
title: options.title, title: options.title,
prompt: inferred prompt: inferred
? `${options.prompt} (inferred from ${inferred.source})` ? t('{prompt} (inferred from {source})', { prompt: options.prompt, source: inferred.source })
: options.prompt, : options.prompt,
value: initialValue, value: initialValue,
placeHolder: 'rstudio' placeHolder: 'rstudio'
...@@ -413,7 +488,7 @@ function promptForInferredApp(options, inferred) { ...@@ -413,7 +488,7 @@ function promptForInferredApp(options, inferred) {
return new Promise((resolve) => { return new Promise((resolve) => {
const quickPick = vscode.window.createQuickPick(); const quickPick = vscode.window.createQuickPick();
const okItem = { label: '', description: inferred.source, action: 'ok' }; const okItem = { label: '', description: inferred.source, action: 'ok' };
const cancelItem = { label: '$(close) Отмена', action: 'cancel' }; const cancelItem = { label: `$(close) ${t('Cancel')}`, action: 'cancel' };
let settled = false; let settled = false;
const finish = (value) => { const finish = (value) => {
...@@ -431,7 +506,10 @@ function promptForInferredApp(options, inferred) { ...@@ -431,7 +506,10 @@ function promptForInferredApp(options, inferred) {
}; };
quickPick.title = options.title; quickPick.title = options.title;
quickPick.placeholder = `${options.prompt} (inferred from ${inferred.source})`; quickPick.placeholder = t('{prompt} (inferred from {source})', {
prompt: options.prompt,
source: inferred.source
});
quickPick.value = inferred.app; quickPick.value = inferred.app;
quickPick.matchOnDescription = true; quickPick.matchOnDescription = true;
updateOkItem(quickPick.value); updateOkItem(quickPick.value);
...@@ -465,7 +543,7 @@ function promptForSystems(options) { ...@@ -465,7 +543,7 @@ function promptForSystems(options) {
value: options.fallback, value: options.fallback,
fallback: 'fedora', fallback: 'fedora',
okLabel: 'OK', okLabel: 'OK',
cancelLabel: 'Отмена' cancelLabel: t('Cancel')
}); });
} }
...@@ -519,7 +597,7 @@ function promptForEditableValue(options) { ...@@ -519,7 +597,7 @@ function promptForEditableValue(options) {
async function rerunLast() { async function rerunLast() {
const command = getWorkspaceState('lastCommand', lastRun); const command = getWorkspaceState('lastCommand', lastRun);
if (!command) { if (!command) {
vscode.window.showWarningMessage('No epm-docker-test command has been run yet.'); vscode.window.showWarningMessage(t('No epm-docker-test command has been run yet.'));
return; return;
} }
...@@ -549,12 +627,12 @@ async function executeTest(request) { ...@@ -549,12 +627,12 @@ async function executeTest(request) {
} }
if (!request.exec && !request.app) { if (!request.exec && !request.app) {
vscode.window.showErrorMessage('Favorite must define either app or exec.'); vscode.window.showErrorMessage(t('Favorite must define either app or exec.'));
return; return;
} }
if (!request.preset && (!request.systems || request.systems.length === 0)) { if (!request.preset && (!request.systems || request.systems.length === 0)) {
vscode.window.showErrorMessage('Test command must define systems or preset.'); vscode.window.showErrorMessage(t('Test command must define systems or preset.'));
return; return;
} }
...@@ -643,7 +721,7 @@ function addStringArg(args, flag, value) { ...@@ -643,7 +721,7 @@ function addStringArg(args, flag, value) {
async function pickPreset(defaultPreset) { async function pickPreset(defaultPreset) {
return vscode.window.showQuickPick(['main', 'russian', 'all'], { return vscode.window.showQuickPick(['main', 'russian', 'all'], {
title: 'EPM Docker Test', title: 'EPM Docker Test',
placeHolder: `Choose a preset (${defaultPreset})` placeHolder: t('Choose a preset ({preset})', { preset: defaultPreset })
}); });
} }
...@@ -651,10 +729,10 @@ async function openLogs() { ...@@ -651,10 +729,10 @@ async function openLogs() {
const logRoot = configuredLogRoot(); const logRoot = configuredLogRoot();
if (!fs.existsSync(logRoot)) { if (!fs.existsSync(logRoot)) {
const answer = await vscode.window.showInformationMessage( const answer = await vscode.window.showInformationMessage(
`Log folder does not exist yet: ${logRoot}`, t('Log folder does not exist yet: {logRoot}', { logRoot }),
'Open Parent' t('Open Parent')
); );
if (answer !== 'Open Parent') { if (answer !== t('Open Parent')) {
return; return;
} }
await vscode.commands.executeCommand('vscode.openFolder', vscode.Uri.file(path.dirname(logRoot)), { await vscode.commands.executeCommand('vscode.openFolder', vscode.Uri.file(path.dirname(logRoot)), {
...@@ -687,7 +765,7 @@ function resolvePaths() { ...@@ -687,7 +765,7 @@ function resolvePaths() {
: findScript(workspaceFolder, detectedEepmRoot); : findScript(workspaceFolder, detectedEepmRoot);
if (!script || !fs.existsSync(script)) { if (!script || !fs.existsSync(script)) {
vscode.window.showErrorMessage('Could not find epm-docker-test.sh. Set epmDockerTest.scriptPath.'); vscode.window.showErrorMessage(t('Could not find epm-docker-test.sh. Set epmDockerTest.scriptPath.'));
return undefined; return undefined;
} }
......
{ {
"name": "epm-docker-test-runner", "name": "epm-docker-test-runner",
"displayName": "EPM Docker Test Runner", "displayName": "%extension.displayName%",
"description": "VS Code buttons for running epm-docker-test.sh test commands.", "description": "%extension.description%",
"version": "0.1.0", "version": "0.1.0",
"publisher": "eter", "publisher": "eter",
"engines": { "engines": {
...@@ -28,70 +28,70 @@ ...@@ -28,70 +28,70 @@
"commands": [ "commands": [
{ {
"command": "epmDockerTest.runQuick", "command": "epmDockerTest.runQuick",
"title": "EPM Docker Test: Run..." "title": "%command.runQuick.title%"
}, },
{ {
"command": "epmDockerTest.runApp", "command": "epmDockerTest.runApp",
"title": "EPM Docker Test: Run App on Systems" "title": "%command.runApp.title%"
}, },
{ {
"command": "epmDockerTest.runAppParallel", "command": "epmDockerTest.runAppParallel",
"title": "EPM Docker Test: Run App on Systems in Parallel" "title": "%command.runAppParallel.title%"
}, },
{ {
"command": "epmDockerTest.runPreset", "command": "epmDockerTest.runPreset",
"title": "EPM Docker Test: Run App Preset" "title": "%command.runPreset.title%"
}, },
{ {
"command": "epmDockerTest.runExec", "command": "epmDockerTest.runExec",
"title": "EPM Docker Test: Run Exec Command" "title": "%command.runExec.title%"
}, },
{ {
"command": "epmDockerTest.runLocalPlay", "command": "epmDockerTest.runLocalPlay",
"title": "EPM Docker Test: Local epm play" "title": "%command.runLocalPlay.title%"
}, },
{ {
"command": "epmDockerTest.runLocalPlayLatest", "command": "epmDockerTest.runLocalPlayLatest",
"title": "EPM Docker Test: Local epm play --latest" "title": "%command.runLocalPlayLatest.title%"
}, },
{ {
"command": "epmDockerTest.runLocalRemove", "command": "epmDockerTest.runLocalRemove",
"title": "EPM Docker Test: Local epm remove" "title": "%command.runLocalRemove.title%"
}, },
{ {
"command": "epmDockerTest.rerunLast", "command": "epmDockerTest.rerunLast",
"title": "EPM Docker Test: Rerun Last Command" "title": "%command.rerunLast.title%"
}, },
{ {
"command": "epmDockerTest.openLogs", "command": "epmDockerTest.openLogs",
"title": "EPM Docker Test: Open Log Folder" "title": "%command.openLogs.title%"
}, },
{ {
"command": "epmDockerTest.refresh", "command": "epmDockerTest.refresh",
"title": "EPM Docker Test: Refresh" "title": "%command.refresh.title%"
}, },
{ {
"command": "epmDockerTest.configure", "command": "epmDockerTest.configure",
"title": "EPM Docker Test: Configure" "title": "%command.configure.title%"
} }
], ],
"configuration": { "configuration": {
"title": "EPM Docker Test", "title": "%configuration.title%",
"properties": { "properties": {
"epmDockerTest.scriptPath": { "epmDockerTest.scriptPath": {
"type": "string", "type": "string",
"default": "", "default": "",
"description": "Path to epm-docker-test.sh. Empty means auto-detect in the workspace." "description": "%configuration.scriptPath.description%"
}, },
"epmDockerTest.workingDirectory": { "epmDockerTest.workingDirectory": {
"type": "string", "type": "string",
"default": "", "default": "",
"description": "Working directory for test commands. Empty means the workspace folder or script directory." "description": "%configuration.workingDirectory.description%"
}, },
"epmDockerTest.defaultSystems": { "epmDockerTest.defaultSystems": {
"type": "string", "type": "string",
"default": "fedora", "default": "fedora",
"description": "Default systems used by Run App on Systems." "description": "%configuration.defaultSystems.description%"
}, },
"epmDockerTest.defaultPreset": { "epmDockerTest.defaultPreset": {
"type": "string", "type": "string",
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
"all" "all"
], ],
"default": "main", "default": "main",
"description": "Default preset used by Run App Preset." "description": "%configuration.defaultPreset.description%"
}, },
"epmDockerTest.defaultMode": { "epmDockerTest.defaultMode": {
"type": "string", "type": "string",
...@@ -111,18 +111,33 @@ ...@@ -111,18 +111,33 @@
"remote" "remote"
], ],
"default": "auto", "default": "auto",
"description": "Default runner mode." "description": "%configuration.defaultMode.description%"
},
"epmDockerTest.language": {
"type": "string",
"enum": [
"auto",
"en",
"ru"
],
"enumDescriptions": [
"%configuration.language.auto.description%",
"%configuration.language.en.description%",
"%configuration.language.ru.description%"
],
"default": "auto",
"description": "%configuration.language.description%"
}, },
"epmDockerTest.parallelJobs": { "epmDockerTest.parallelJobs": {
"type": "number", "type": "number",
"default": 0, "default": 0,
"minimum": 0, "minimum": 0,
"description": "Parallel jobs. 0 disables -j/--parallel, 1 runs serially, values greater than 1 pass -j N." "description": "%configuration.parallelJobs.description%"
}, },
"epmDockerTest.eepmDir": { "epmDockerTest.eepmDir": {
"type": "string", "type": "string",
"default": "", "default": "",
"description": "Optional --eepm-dir value." "description": "%configuration.eepmDir.description%"
}, },
"epmDockerTest.eepmSource": { "epmDockerTest.eepmSource": {
"type": "string", "type": "string",
...@@ -131,37 +146,37 @@ ...@@ -131,37 +146,37 @@
"builder64" "builder64"
], ],
"default": "local", "default": "local",
"description": "Value for --eepm-source." "description": "%configuration.eepmSource.description%"
}, },
"epmDockerTest.remoteHost": { "epmDockerTest.remoteHost": {
"type": "string", "type": "string",
"default": "", "default": "",
"description": "Optional --remote-host value." "description": "%configuration.remoteHost.description%"
}, },
"epmDockerTest.remoteUser": { "epmDockerTest.remoteUser": {
"type": "string", "type": "string",
"default": "", "default": "",
"description": "Optional --remote-user value." "description": "%configuration.remoteUser.description%"
}, },
"epmDockerTest.builderUser": { "epmDockerTest.builderUser": {
"type": "string", "type": "string",
"default": "", "default": "",
"description": "Optional --builder-user value." "description": "%configuration.builderUser.description%"
}, },
"epmDockerTest.builderPath": { "epmDockerTest.builderPath": {
"type": "string", "type": "string",
"default": "", "default": "",
"description": "Optional --builder-path value." "description": "%configuration.builderPath.description%"
}, },
"epmDockerTest.logRoot": { "epmDockerTest.logRoot": {
"type": "string", "type": "string",
"default": "", "default": "",
"description": "Optional --log-root value." "description": "%configuration.logRoot.description%"
}, },
"epmDockerTest.localEpmRoot": { "epmDockerTest.localEpmRoot": {
"type": "string", "type": "string",
"default": "/home/vano/eter/static2/eepm", "default": "/home/vano/eter/static2/eepm",
"description": "Path to the local eepm tree used by local ./bin/epm play commands." "description": "%configuration.localEpmRoot.description%"
}, },
"epmDockerTest.additionalArgs": { "epmDockerTest.additionalArgs": {
"type": "array", "type": "array",
...@@ -169,12 +184,12 @@ ...@@ -169,12 +184,12 @@
"items": { "items": {
"type": "string" "type": "string"
}, },
"description": "Extra arguments passed before the app/exec target." "description": "%configuration.additionalArgs.description%"
}, },
"epmDockerTest.favorites": { "epmDockerTest.favorites": {
"type": "array", "type": "array",
"default": [], "default": [],
"description": "Pinned commands shown as buttons in the EPM Test activity view.", "description": "%configuration.favorites.description%",
"items": { "items": {
"type": "object", "type": "object",
"properties": { "properties": {
...@@ -203,7 +218,7 @@ ...@@ -203,7 +218,7 @@
}, },
"latest": { "latest": {
"type": "boolean", "type": "boolean",
"description": "Pass --latest for this favorite app test." "description": "%configuration.favorites.latest.description%"
}, },
"args": { "args": {
"type": "array", "type": "array",
...@@ -220,7 +235,7 @@ ...@@ -220,7 +235,7 @@
"activitybar": [ "activitybar": [
{ {
"id": "epmDockerTest", "id": "epmDockerTest",
"title": "EPM Test", "title": "%viewsContainers.epmDockerTest.title%",
"icon": "resources/epm-test.svg" "icon": "resources/epm-test.svg"
} }
] ]
...@@ -229,7 +244,7 @@ ...@@ -229,7 +244,7 @@
"epmDockerTest": [ "epmDockerTest": [
{ {
"id": "epmDockerTest.actions", "id": "epmDockerTest.actions",
"name": "Actions" "name": "%views.epmDockerTest.actions.name%"
} }
] ]
}, },
......
{
"extension.displayName": "EPM Docker Test Runner",
"extension.description": "VS Code buttons for running epm-docker-test.sh test commands.",
"command.runQuick.title": "EPM Docker Test: Run...",
"command.runApp.title": "EPM Docker Test: Run App on Systems",
"command.runAppParallel.title": "EPM Docker Test: Run App on Systems in Parallel",
"command.runPreset.title": "EPM Docker Test: Run App Preset",
"command.runExec.title": "EPM Docker Test: Run Exec Command",
"command.runLocalPlay.title": "EPM Docker Test: Local epm play",
"command.runLocalPlayLatest.title": "EPM Docker Test: Local epm play --latest",
"command.runLocalRemove.title": "EPM Docker Test: Local epm remove",
"command.rerunLast.title": "EPM Docker Test: Rerun Last Command",
"command.openLogs.title": "EPM Docker Test: Open Log Folder",
"command.refresh.title": "EPM Docker Test: Refresh",
"command.configure.title": "EPM Docker Test: Configure",
"configuration.title": "EPM Docker Test",
"configuration.scriptPath.description": "Path to epm-docker-test.sh. Empty means auto-detect in the workspace.",
"configuration.workingDirectory.description": "Working directory for test commands. Empty means the workspace folder or script directory.",
"configuration.defaultSystems.description": "Default systems used by Run App on Systems.",
"configuration.defaultPreset.description": "Default preset used by Run App Preset.",
"configuration.defaultMode.description": "Default runner mode.",
"configuration.language.description": "Language used by the extension runtime UI. Command titles and settings labels still follow the VS Code interface language.",
"configuration.language.auto.description": "Follow the VS Code interface language.",
"configuration.language.en.description": "Force English for the extension runtime UI.",
"configuration.language.ru.description": "Force Russian for the extension runtime UI.",
"configuration.parallelJobs.description": "Parallel jobs. 0 disables -j/--parallel, 1 runs serially, values greater than 1 pass -j N.",
"configuration.eepmDir.description": "Optional --eepm-dir value.",
"configuration.eepmSource.description": "Value for --eepm-source.",
"configuration.remoteHost.description": "Optional --remote-host value.",
"configuration.remoteUser.description": "Optional --remote-user value.",
"configuration.builderUser.description": "Optional --builder-user value.",
"configuration.builderPath.description": "Optional --builder-path value.",
"configuration.logRoot.description": "Optional --log-root value.",
"configuration.localEpmRoot.description": "Path to the local eepm tree used by local ./bin/epm play and ./bin/epm remove commands.",
"configuration.additionalArgs.description": "Extra arguments passed before the app/exec target.",
"configuration.favorites.description": "Pinned commands shown as buttons in the EPM Test activity view.",
"configuration.favorites.latest.description": "Pass --latest for this favorite app test.",
"viewsContainers.epmDockerTest.title": "EPM Test",
"views.epmDockerTest.actions.name": "Actions"
}
{
"extension.displayName": "Запуск тестов EPM Docker",
"extension.description": "Кнопки VS Code для запуска тестовых команд epm-docker-test.sh.",
"command.runQuick.title": "EPM Docker Test: Запустить...",
"command.runApp.title": "EPM Docker Test: Запустить приложение на системах",
"command.runAppParallel.title": "EPM Docker Test: Запустить приложение на системах параллельно",
"command.runPreset.title": "EPM Docker Test: Запустить пресет приложения",
"command.runExec.title": "EPM Docker Test: Выполнить команду",
"command.runLocalPlay.title": "EPM Docker Test: Локально epm play",
"command.runLocalPlayLatest.title": "EPM Docker Test: Локально epm play --latest",
"command.runLocalRemove.title": "EPM Docker Test: Локально epm remove",
"command.rerunLast.title": "EPM Docker Test: Повторить последнюю команду",
"command.openLogs.title": "EPM Docker Test: Открыть каталог логов",
"command.refresh.title": "EPM Docker Test: Обновить",
"command.configure.title": "EPM Docker Test: Настроить",
"configuration.title": "EPM Docker Test",
"configuration.scriptPath.description": "Путь к epm-docker-test.sh. Пустое значение означает автоопределение в рабочей папке.",
"configuration.workingDirectory.description": "Рабочий каталог для тестовых команд. Пустое значение означает рабочую папку VS Code или каталог скрипта.",
"configuration.defaultSystems.description": "Системы по умолчанию для запуска приложения на системах.",
"configuration.defaultPreset.description": "Пресет по умолчанию для запуска приложения по пресету.",
"configuration.defaultMode.description": "Режим запуска по умолчанию.",
"configuration.language.description": "Язык runtime-интерфейса расширения. Названия команд и подписей настроек по-прежнему зависят от языка интерфейса VS Code.",
"configuration.language.auto.description": "Использовать язык интерфейса VS Code.",
"configuration.language.en.description": "Принудительно использовать английский язык в runtime-интерфейсе расширения.",
"configuration.language.ru.description": "Принудительно использовать русский язык в runtime-интерфейсе расширения.",
"configuration.parallelJobs.description": "Параллельные задания. 0 отключает -j/--parallel, 1 запускает последовательно, значения больше 1 передают -j N.",
"configuration.eepmDir.description": "Необязательное значение --eepm-dir.",
"configuration.eepmSource.description": "Значение для --eepm-source.",
"configuration.remoteHost.description": "Необязательное значение --remote-host.",
"configuration.remoteUser.description": "Необязательное значение --remote-user.",
"configuration.builderUser.description": "Необязательное значение --builder-user.",
"configuration.builderPath.description": "Необязательное значение --builder-path.",
"configuration.logRoot.description": "Необязательное значение --log-root.",
"configuration.localEpmRoot.description": "Путь к локальному дереву eepm для команд ./bin/epm play и ./bin/epm remove.",
"configuration.additionalArgs.description": "Дополнительные аргументы, передаваемые перед app/exec-целью.",
"configuration.favorites.description": "Закрепленные команды, показанные как кнопки в панели EPM Test.",
"configuration.favorites.latest.description": "Передавать --latest для этого избранного app-теста.",
"viewsContainers.epmDockerTest.title": "EPM Test",
"views.epmDockerTest.actions.name": "Действия"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment