diff --git a/src/components/HrefActions.vue b/src/components/HrefActions.vue index f730c0d37..7443b4247 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 c0176c15d..fb93e42a9 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 1cfd23c68..7294c26fb 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 269103b47..072ec0ee6 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 fbdea90ba..419bc38ad 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 8def86d94..f6f05b135 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 835f8c2ac..bd81ab8f3 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",