diff --git a/src/components/HrefActions.vue b/src/components/HrefActions.vue index f730c0d3..7443b424 100644 --- a/src/components/HrefActions.vue +++ b/src/components/HrefActions.vue @@ -29,6 +29,7 @@ import Utils, { browserProtocols, imageMediaTypes, mapMediaTypes } from '../util import { mapGetters } from 'vuex'; import AssetActions from '../../assetActions.config'; import LinkActions from '../../linkActions.config'; +import URI from 'urijs'; export default { name: 'HrefActions', @@ -115,7 +116,7 @@ export default { } }, isGdalVfs() { - return Utils.isGdalVfsUri(this.data.href); + return Utils.isGdalVfsUri(this.href); }, href() { if (typeof this.data.href !== 'string') { @@ -129,11 +130,11 @@ export default { }, from() { if (this.isGdalVfs) { - let type = this.data.href.match(/^\/vsi([a-z\d]+)(_streaming)?\//); - return this.protocolName(type); + let type = this.href.match(/^\/vsi([a-z\d]+)(_streaming)?\//); + return this.protocolName(type, this.href); } else { - return this.protocolName(this.protocol); + return this.protocolName(this.protocol, this.href); } }, browserCanOpenFile() { @@ -168,13 +169,24 @@ export default { } }, methods: { - protocolName(protocol) { + protocolName(protocol, href = null) { if (typeof protocol !== 'string') { return ''; } switch(protocol.toLowerCase()) { case 's3': - return this.$t('protocol.s3'); + if (href) { + try { + const uri = new URI(href); + const key = `protocol.s3.${uri.domain()}`; + if (this.$te(key)) { + return this.$t(key); + } + } catch (e) { + // Fall back to the default + } + } + return this.$t('protocol.s3.default'); case 'abfs': case 'abfss': return this.$t('protocol.azure'); diff --git a/src/locales/de/texts.json b/src/locales/de/texts.json index c0176c15..fb93e42a 100644 --- a/src/locales/de/texts.json +++ b/src/locales/de/texts.json @@ -171,7 +171,10 @@ "ftp": "FTP", "gcs": "Google Cloud", "oss": "Alibaba Cloud", - "s3": "Amazon S3" + "s3": { + "default": "S3", + "amazonaws.com": "Amazon S3" + } }, "providers": { "email": "E-Mail senden", diff --git a/src/locales/en/texts.json b/src/locales/en/texts.json index 1cfd23c6..7294c26f 100644 --- a/src/locales/en/texts.json +++ b/src/locales/en/texts.json @@ -171,7 +171,10 @@ "ftp": "FTP", "gcs": "Google Cloud", "oss": "Alibaba Cloud", - "s3": "Amazon S3" + "s3": { + "default": "S3", + "amazonaws.com": "Amazon S3" + } }, "providers": { "email": "Send e-mail", diff --git a/src/locales/es/texts.json b/src/locales/es/texts.json index 269103b4..072ec0ee 100644 --- a/src/locales/es/texts.json +++ b/src/locales/es/texts.json @@ -171,7 +171,10 @@ "ftp": "FTP", "gcs": "Google Cloud", "oss": "Alibaba Cloud", - "s3": "Amazon S3" + "s3": { + "default": "S3", + "amazonaws.com": "Amazon S3" + } }, "providers": { "email": "Enviar e-mail", diff --git a/src/locales/fr/texts.json b/src/locales/fr/texts.json index fbdea90b..419bc38a 100644 --- a/src/locales/fr/texts.json +++ b/src/locales/fr/texts.json @@ -171,7 +171,10 @@ "ftp": "FTP", "gcs": "Google Cloud", "oss": "Alibaba Cloud", - "s3": "Amazon S3" + "s3": { + "default": "S3", + "amazonaws.com": "Amazon S3" + } }, "providers": { "email": "Envoyer un courriel", diff --git a/src/locales/it/texts.json b/src/locales/it/texts.json index 8def86d9..f6f05b13 100644 --- a/src/locales/it/texts.json +++ b/src/locales/it/texts.json @@ -171,7 +171,10 @@ "ftp": "FTP", "gcs": "Google Cloud", "oss": "Alibaba Cloud", - "s3": "Amazon S3" + "s3": { + "default": "S3", + "amazonaws.com": "Amazon S3" + } }, "providers": { "email": "Invia e-mail", diff --git a/src/locales/ro/texts.json b/src/locales/ro/texts.json index 835f8c2a..bd81ab8f 100644 --- a/src/locales/ro/texts.json +++ b/src/locales/ro/texts.json @@ -165,7 +165,10 @@ "ftp": "FTP", "gcs": "Google Cloud", "oss": "Alibaba Cloud", - "s3": "Amazon S3" + "s3": { + "default": "S3", + "amazonaws.com": "Amazon S3" + } }, "providers": { "email": "Trimite un email",