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
11 changed files with 24 additions and 14 deletions

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) {