From 57592e997aaaff8dc72fbfa987ac1860197e916d Mon Sep 17 00:00:00 2001 From: Raul Soledispa Date: Sun, 2 Oct 2022 10:10:43 -0500 Subject: [PATCH] Use translated string in copy confirmation message (#383) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 Co-authored-by: Matt Cowley --- src/nginxconfig/i18n/de/templates/app.js | 3 ++- src/nginxconfig/i18n/en/templates/app.js | 3 ++- src/nginxconfig/i18n/es/templates/app.js | 3 ++- src/nginxconfig/i18n/fr/templates/app.js | 3 ++- src/nginxconfig/i18n/ja/templates/app.js | 1 + src/nginxconfig/i18n/pl/templates/app.js | 3 ++- src/nginxconfig/i18n/pt-br/templates/app.js | 3 ++- src/nginxconfig/i18n/ru/templates/app.js | 3 ++- src/nginxconfig/i18n/zh-cn/templates/app.js | 3 ++- src/nginxconfig/i18n/zh-tw/templates/app.js | 1 + src/nginxconfig/templates/setup.vue | 12 ++++++------ 11 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/nginxconfig/i18n/de/templates/app.js b/src/nginxconfig/i18n/de/templates/app.js index 14933c9..eed31c9 100644 --- a/src/nginxconfig/i18n/de/templates/app.js +++ b/src/nginxconfig/i18n/de/templates/app.js @@ -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', }; diff --git a/src/nginxconfig/i18n/en/templates/app.js b/src/nginxconfig/i18n/en/templates/app.js index 71c3607..66fbfc1 100644 --- a/src/nginxconfig/i18n/en/templates/app.js +++ b/src/nginxconfig/i18n/en/templates/app.js @@ -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', }; diff --git a/src/nginxconfig/i18n/es/templates/app.js b/src/nginxconfig/i18n/es/templates/app.js index 95b727f..d10755b 100644 --- a/src/nginxconfig/i18n/es/templates/app.js +++ b/src/nginxconfig/i18n/es/templates/app.js @@ -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', }; diff --git a/src/nginxconfig/i18n/fr/templates/app.js b/src/nginxconfig/i18n/fr/templates/app.js index 05fefb0..3d51651 100644 --- a/src/nginxconfig/i18n/fr/templates/app.js +++ b/src/nginxconfig/i18n/fr/templates/app.js @@ -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é', }; diff --git a/src/nginxconfig/i18n/ja/templates/app.js b/src/nginxconfig/i18n/ja/templates/app.js index d735fb6..b5d2467 100644 --- a/src/nginxconfig/i18n/ja/templates/app.js +++ b/src/nginxconfig/i18n/ja/templates/app.js @@ -36,4 +36,5 @@ export default { globalConfig: 'グローバル設定', setup: 'セットアップ', configFiles: '設定ファイル', + copied: 'コピーしました', }; diff --git a/src/nginxconfig/i18n/pl/templates/app.js b/src/nginxconfig/i18n/pl/templates/app.js index dd19bba..137fe14 100644 --- a/src/nginxconfig/i18n/pl/templates/app.js +++ b/src/nginxconfig/i18n/pl/templates/app.js @@ -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', }; diff --git a/src/nginxconfig/i18n/pt-br/templates/app.js b/src/nginxconfig/i18n/pt-br/templates/app.js index 627a0a4..0300223 100644 --- a/src/nginxconfig/i18n/pt-br/templates/app.js +++ b/src/nginxconfig/i18n/pt-br/templates/app.js @@ -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', }; diff --git a/src/nginxconfig/i18n/ru/templates/app.js b/src/nginxconfig/i18n/ru/templates/app.js index c2bb15c..119b77f 100644 --- a/src/nginxconfig/i18n/ru/templates/app.js +++ b/src/nginxconfig/i18n/ru/templates/app.js @@ -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: 'Скопировано', }; diff --git a/src/nginxconfig/i18n/zh-cn/templates/app.js b/src/nginxconfig/i18n/zh-cn/templates/app.js index 7c382f0..14b37bc 100644 --- a/src/nginxconfig/i18n/zh-cn/templates/app.js +++ b/src/nginxconfig/i18n/zh-cn/templates/app.js @@ -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: '已复制', }; diff --git a/src/nginxconfig/i18n/zh-tw/templates/app.js b/src/nginxconfig/i18n/zh-tw/templates/app.js index caa0c94..266d48f 100644 --- a/src/nginxconfig/i18n/zh-tw/templates/app.js +++ b/src/nginxconfig/i18n/zh-tw/templates/app.js @@ -36,4 +36,5 @@ export default { globalConfig: '全域設定', setup: '使用設定', configFiles: '設定檔', + copied: '已復制', }; diff --git a/src/nginxconfig/templates/setup.vue b/src/nginxconfig/templates/setup.vue index c109109..c9be8a1 100644 --- a/src/nginxconfig/templates/setup.vue +++ b/src/nginxconfig/templates/setup.vue @@ -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) {