Skip to content

Commit

Permalink
Use translated string in copy confirmation message (digitalocean#383)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: Matt Cowley <[email protected]>
  • Loading branch information
3 people authored Oct 2, 2022
1 parent 6cdd089 commit 57592e9
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/nginxconfig/i18n/de/templates/app.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -36,4 +36,5 @@ export default {
globalConfig: 'Globale Konfiguration',
setup: 'Setup',
configFiles: 'Konfigurationsdateien',
copied: 'kopiert',
};
3 changes: 2 additions & 1 deletion src/nginxconfig/i18n/en/templates/app.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -36,4 +36,5 @@ export default {
globalConfig: 'Global config',
setup: 'Setup',
configFiles: 'Config files',
copied: 'Copied',
};
3 changes: 2 additions & 1 deletion src/nginxconfig/i18n/es/templates/app.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -36,4 +36,5 @@ export default {
globalConfig: 'Configuración global',
setup: 'Configuración',
configFiles: 'Archivos de configuración',
copied: 'Copiado',
};
3 changes: 2 additions & 1 deletion src/nginxconfig/i18n/fr/templates/app.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -36,4 +36,5 @@ export default {
globalConfig: 'Configuration globale',
setup: 'Configurer',
configFiles: 'Fichiers de configuration',
copied: 'Copié',
};
1 change: 1 addition & 0 deletions src/nginxconfig/i18n/ja/templates/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ export default {
globalConfig: 'グローバル設定',
setup: 'セットアップ',
configFiles: '設定ファイル',
copied: 'コピーしました',
};
3 changes: 2 additions & 1 deletion src/nginxconfig/i18n/pl/templates/app.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -36,4 +36,5 @@ export default {
globalConfig: 'Konfiguracja globalna',
setup: 'Setup',
configFiles: 'Pliki konfiguracyjne',
copied: 'Skopiowane',
};
3 changes: 2 additions & 1 deletion src/nginxconfig/i18n/pt-br/templates/app.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -36,4 +36,5 @@ export default {
globalConfig: 'Configuração global',
setup: 'Configurar',
configFiles: 'Arquivos de configuração',
copied: 'Copiado',
};
3 changes: 2 additions & 1 deletion src/nginxconfig/i18n/ru/templates/app.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -36,4 +36,5 @@ export default {
globalConfig: 'Глобальная конфигурация',
setup: 'Настройка',
configFiles: 'Файлы конфигурации',
copied: 'Скопировано',
};
3 changes: 2 additions & 1 deletion src/nginxconfig/i18n/zh-cn/templates/app.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -36,4 +36,5 @@ export default {
globalConfig: '全局配置',
setup: '使用配置',
configFiles: '配置文件',
copied: '已复制',
};
1 change: 1 addition & 0 deletions src/nginxconfig/i18n/zh-tw/templates/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ export default {
globalConfig: '全域設定',
setup: '使用設定',
configFiles: '設定檔',
copied: '已復制',
};
12 changes: 6 additions & 6 deletions src/nginxconfig/templates/setup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit 57592e9

Please sign in to comment.