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. This code is licensed under the MIT License.
You may obtain a copy of the License at You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Globale Konfiguration', globalConfig: 'Globale Konfiguration',
setup: 'Setup', setup: 'Setup',
configFiles: 'Konfigurationsdateien', configFiles: 'Konfigurationsdateien',
copied: 'kopiert',
}; };

View file

@ -1,5 +1,5 @@
/* /*
Copyright 2020 DigitalOcean Copyright 2022 DigitalOcean
This code is licensed under the MIT License. This code is licensed under the MIT License.
You may obtain a copy of the License at You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Global config', globalConfig: 'Global config',
setup: 'Setup', setup: 'Setup',
configFiles: 'Config files', 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. This code is licensed under the MIT License.
You may obtain a copy of the License at You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Configuración global', globalConfig: 'Configuración global',
setup: 'Configuración', setup: 'Configuración',
configFiles: 'Archivos de 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. This code is licensed under the MIT License.
You may obtain a copy of the License at You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Configuration globale', globalConfig: 'Configuration globale',
setup: 'Configurer', setup: 'Configurer',
configFiles: 'Fichiers de configuration', configFiles: 'Fichiers de configuration',
copied: 'Copié',
}; };

View file

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

View file

@ -1,5 +1,5 @@
/* /*
Copyright 2021 DigitalOcean Copyright 2022 DigitalOcean
This code is licensed under the MIT License. This code is licensed under the MIT License.
You may obtain a copy of the License at You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Konfiguracja globalna', globalConfig: 'Konfiguracja globalna',
setup: 'Setup', setup: 'Setup',
configFiles: 'Pliki konfiguracyjne', 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. This code is licensed under the MIT License.
You may obtain a copy of the License at You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Configuração global', globalConfig: 'Configuração global',
setup: 'Configurar', setup: 'Configurar',
configFiles: 'Arquivos de configuração', 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. This code is licensed under the MIT License.
You may obtain a copy of the License at You may obtain a copy of the License at
@ -36,4 +36,5 @@ export default {
globalConfig: 'Глобальная конфигурация', globalConfig: 'Глобальная конфигурация',
setup: 'Настройка', setup: 'Настройка',
configFiles: 'Файлы конфигурации', configFiles: 'Файлы конфигурации',
copied: 'Скопировано',
}; };

View file

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

View file

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

View file

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