Use translated string in copy confirmation message (#383)

* Show message in the corresponding language when the user make clic on download button

* Guardar una copia del texto original para usarla cuando la función de copia se haya resuelto con éxito

* Resolving typos in the component and i18n

* Saving the original text of the button to show it when the copy function throws an error exception

Co-authored-by: Raul Soledispa <rsoledispa@technisys.com>
Co-authored-by: Matt Cowley <me@mattcowley.co.uk>
This commit is contained in:
Raul Soledispa 2022-10-02 10:10:43 -05:00 committed by GitHub
parent 6cdd0898c2
commit 57592e997a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 24 additions and 14 deletions

View file

@ -1,5 +1,5 @@
/*
Copyright 2021 DigitalOcean
Copyright 2022 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Globale Konfiguration',
setup: 'Setup',
configFiles: 'Konfigurationsdateien',
copied: 'kopiert',
};

View file

@ -1,5 +1,5 @@
/*
Copyright 2020 DigitalOcean
Copyright 2022 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Global config',
setup: 'Setup',
configFiles: 'Config files',
copied: 'Copied',
};

View file

@ -1,5 +1,5 @@
/*
Copyright 2021 DigitalOcean
Copyright 2022 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Configuración global',
setup: 'Configuración',
configFiles: 'Archivos de configuración',
copied: 'Copiado',
};

View file

@ -1,5 +1,5 @@
/*
Copyright 2021 DigitalOcean
Copyright 2022 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Configuration globale',
setup: 'Configurer',
configFiles: 'Fichiers de configuration',
copied: 'Copié',
};

View file

@ -36,4 +36,5 @@ export default {
globalConfig: 'グローバル設定',
setup: 'セットアップ',
configFiles: '設定ファイル',
copied: 'コピーしました',
};

View file

@ -1,5 +1,5 @@
/*
Copyright 2021 DigitalOcean
Copyright 2022 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Konfiguracja globalna',
setup: 'Setup',
configFiles: 'Pliki konfiguracyjne',
copied: 'Skopiowane',
};

View file

@ -1,5 +1,5 @@
/*
Copyright 2020 DigitalOcean
Copyright 2022 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Configuração global',
setup: 'Configurar',
configFiles: 'Arquivos de configuração',
copied: 'Copiado',
};

View file

@ -1,5 +1,5 @@
/*
Copyright 2021 DigitalOcean
Copyright 2022 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Глобальная конфигурация',
setup: 'Настройка',
configFiles: 'Файлы конфигурации',
copied: 'Скопировано',
};

View file

@ -1,5 +1,5 @@
/*
Copyright 2020 DigitalOcean
Copyright 2022 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: '全局配置',
setup: '使用配置',
configFiles: '配置文件',
copied: '已复制',
};

View file

@ -36,4 +36,5 @@ export default {
globalConfig: '全域設定',
setup: '使用設定',
configFiles: '設定檔',
copied: '已復制',
};

View file

@ -150,9 +150,7 @@ THE SOFTWARE.
return this.tarContents().base64(path);
},
setupCopy(elm) {
const originalText = elm.textContent;
const resetText = () => {
const resetText = (originalText) => {
setTimeout(() => {
elm.textContent = originalText;
}, 5000);
@ -163,14 +161,16 @@ THE SOFTWARE.
});
clipboard.on('success', e => {
elm.textContent = 'Copied';
const originalTextCopy = elm.textContent;
elm.textContent = this.$t('templates.app.copied');
e.clearSelection();
resetText();
resetText(originalTextCopy);
});
clipboard.on('error', () => {
const originalTextCopy = elm.textContent;
elm.textContent = 'Press Ctrl + C to copy';
resetText();
resetText(originalTextCopy);
});
},
showTab(target) {