Skip to content

Commit

Permalink
feat: update translations
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianRuen committed Jul 8, 2024
1 parent 9d2edbc commit 2d5a485
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 88 deletions.
39 changes: 18 additions & 21 deletions l10n/en_GB.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
OC.L10N.register(
"cidgravitygateway",
{
"CIDgravity" : "CIDgravity",
"Choose an IPFS gateway to use for links" : "Choose an IPFS gateway to use for links",
"Directory metadata" : "Directory metadata",
"File metadata" : "File metadata",
"Something wrong while loading metadata" : "Something wrong while loading metadata",
"Choose an IPFS gateway to use" : "Choose an IPFS gateway to use",
"Type your custom IPFS gateway link, ending with /ipfs" : "Type your custom IPFS gateway link, ending with /ipfs",
"Click to open the IPFS link" : "Click to open the IPFS link",
"Copy public link" : "Copy public link",
"CID" : "CID",
"Copy file CID" : "Copy CID",
"Not on an external storage" : "Not on an external storage",
"Not on an CIDgravity storage" : "Not on an CIDgravity storage",
"This {contentType} is not on an external storage. To display metadata, you must browse files on external storage" : "This {contentType} is not on an external storage. To display metadata, you must browse files on external storage",
"This {contentType} is not on an CIDgravity storage type. To display metadata, you must browse files on external storage" : "This {contentType} is not on an CIDgravity storage type. To display metadata, you must browse files on external storage",
"CID copied" : "CID copied",
"Unable to copy the file CID" : "Unable to copy the CID",
"Public link copied" : "Public link copied",
"Unable to copy the public link" : "Unable to copy the public link"
},
"nplurals=2; plural=(n != 1);");
"CIDgravity": "CIDgravity",
"Select an IPFS gateway": "Select an IPFS gateway",
"Directory metadata": "Directory metadata",
"File metadata": "File metadata",
"Something went wrong while loading metadata": "Something went wrong while loading metadata",
"Click to open": "Click to open",
"IPFS public link": "IPFS public link",
"Copy link": "Copy link",
"CID": "CID",
"Copy CID": "Copy CID",
"Not metadata available": "Not metadata available",
"This {contentType} is not located on a CIDgravity external storage.": "This {contentType} is not located on a CIDgravity external storage.",
"CID copied": "CID copied",
"Unable to copy the CID": "Unable to copy the CID",
"Public link copied": "Public link copied",
"Unable to copy the public link": "Unable to copy the public link"
},
"nplurals=2; plural=(n != 1);");
32 changes: 16 additions & 16 deletions l10n/en_GB.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{ "translations": {
"CIDgravity" : "CIDgravity",
"Something wrong while loading metadata" : "Something wrong while loading metadata",
"Choose an IPFS gateway to use" : "Choose an IPFS gateway to use",
"Type your IPFS gateway link, ending with /ipfs" : "Type your IPFS gateway link, ending with /ipfs",
"Click to open the IPFS link" : "Click to open the IPFS link",
"Copy public link" : "Copy public link",
"File CID" : "File CID",
"Copy file CID" : "Copy file CID",
"Not on an external storage" : "Not on an external storage",
"Not on an CIDgravity storage" : "Not on an CIDgravity storage",
"This {contentType} is not on an external storage. To display metadata, you must browse files on external storage" : "This {contentType} is not on an external storage. To display metadata, you must browse files on external storage",
"This {contentType} is not on an CIDgravity storage type. To display metadata, you must browse files on external storage" : "This {contentType} is not on an CIDgravity storage type. To display metadata, you must browse files on external storage",
"CID copied" : "CID copied",
"Unable to copy the file CID" : "Unable to copy the file CID",
"Public link copied" : "Public link copied",
"Unable to copy the public link" : "Unable to copy the public link"
"CIDgravity": "CIDgravity",
"Select an IPFS gateway": "Select an IPFS gateway",
"Directory metadata": "Directory metadata",
"File metadata": "File metadata",
"Something went wrong while loading metadata": "Something went wrong while loading metadata",
"Click to open": "Click to open",
"IPFS public link": "IPFS public link",
"Copy link": "Copy link",
"CID": "CID",
"Copy CID": "Copy CID",
"Not metadata available": "Not metadata available",
"This {contentType} is not located on a CIDgravity external storage.": "This {contentType} is not located on a CIDgravity external storage.",
"CID copied": "CID copied",
"Unable to copy the file CID": "Unable to copy the CID",
"Public link copied": "Public link copied",
"Unable to copy the public link": "Unable to copy the public link"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
6 changes: 3 additions & 3 deletions lib/Service/BackendService.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public function __construct(IL10N $l, Password $legacyAuth) {
->setStorageClass('\OC\Files\Storage\DAV')
->setText($l->t('CIDgravity'))
->addParameters([
new DefinitionParameter('host', $l->t('URL')),
new DefinitionParameter('host', $l->t('CIDgravity gateway URL')),
(new DefinitionParameter('root', $l->t('Remote subfolder')))
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
(new DefinitionParameter('secure', $l->t('Secure https://')))
->setType(DefinitionParameter::VALUE_BOOLEAN)
->setDefaultValue(true),
new DefinitionParameter('metadata_endpoint', $l->t('Metadata endpoint')),
(new DefinitionParameter('default_ipfs_gateway', $l->t('Default IPFS gateway')))
new DefinitionParameter('metadata_endpoint', $l->t('CIDgravity metadata URL')),
(new DefinitionParameter('default_ipfs_gateway', $l->t('Default IPFS gateway URL')))
->setType(DefinitionParameter::VALUE_TEXT)
->setDefaultValue('https://ipfs.io/ipfs')
->setTooltip('You can also use your custom gateway or public gateway such as https://dweb.link'),
Expand Down
60 changes: 12 additions & 48 deletions src/views/GatewayTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<!-- Error loading storage type -->
<NcEmptyContent v-else-if="isErrorLocal"
class="emptyContent"
:name="t('cidgravitygateway', 'Something wrong while loading metadata')"
:name="t('cidgravitygateway', 'Something went wrong while loading metadata')"
:description="errorMessage">
<template #icon>
<AlertCircleOutlineIcon />
Expand All @@ -24,27 +24,19 @@
<div v-else>
<div class="ipfs-gateway-select">
<strong>
<h3>{{ t('cidgravitygateway', 'Choose an IPFS gateway to use for links') }}</h3>
<h3>{{ t('cidgravitygateway', 'Select an IPFS gateway') }}</h3>
</strong>

<NcSelect ref="select"
v-model="ipfsGateway"
input-id="ipfs-gateway-input"
class="ipfs-gateway__input"
:loading="loading"
:placeholder="t('cidgravitygateway', 'Choose an IPFS gateway to use for links')"
:placeholder="t('cidgravitygateway', 'Select an IPFS gateway')"
:options="ipfsGatewayOptions"
@option:selected="onIpfsGatewaySelected" />
</div>

<div v-if="isCustomIpfsGateway" class="ipfs-custom-gateway-input">
<input v-model="ipfsGateway.link"
input-id="ipfs-custom-gateway-input"
:placeholder="t('cidgravitygateway', 'Type your custom IPFS gateway link, ending with /ipfs')"
type="text"
style="width: 100%; margin-top: 10px; margin-bottom: 10px;">
</div>

<ul v-if="!loading" style="margin-top: 30px;">
<strong>
<h3>{{ getMetadataSectionTitle }}</h3>
Expand All @@ -53,14 +45,14 @@
<TabLinkEntrySimple ref="ipfsPublicLinkEntry"
class="menu-entry__internal"
:title="t('cidgravitygateway', 'IPFS public link')"
:subtitle="t('cidgravitygateway', 'Click to open the IPFS link')"
:subtitle="t('cidgravitygateway', 'Click to open')"
:link="ipfsPublicLink">
<template #avatar>
<div class="entry-icon-primary icon-public-white" />
</template>

<NcActionButton :title="t('cidgravitygateway', 'Copy public link')"
:aria-label="t('cidgravitygateway', 'Copy public link')"
<NcActionButton :title="t('cidgravitygateway', 'Copy link')"
:aria-label="t('cidgravitygateway', 'Copy link')"
@click="copyIpfsPublicLink">
<template #icon>
<ClipboardIcon :size="20" />
Expand Down Expand Up @@ -128,10 +120,9 @@ export default {
return {
loading: true,
ipfsGatewayOptions: [
{ id: 'gateway.pinata.cloud', label: 'gateway.pinata.cloud', link: 'https://gateway.pinata.cloud/ipfs', isCustom: false },
{ id: 'ipfs.io', label: 'ipfs.io', link: 'https://ipfs.io/ipfs', isCustom: false },
{ id: 'dweb.link', label: 'dweb.link', link: 'https://dweb.link/ipfs', isCustom: false },
{ id: 'Custom gateway', label: 'Custom gateway', link: null, isCustom: true },
{ id: 'gateway.pinata.cloud', label: 'gateway.pinata.cloud', link: 'https://gateway.pinata.cloud/ipfs' },
{ id: 'ipfs.io', label: 'ipfs.io', link: 'https://ipfs.io/ipfs' },
{ id: 'dweb.link', label: 'dweb.link', link: 'https://dweb.link/ipfs' },
],
selectedOption: null,
fileInfo: {},
Expand All @@ -155,11 +146,7 @@ export default {
return this.$parent.activeTab
},
emptyContentTitle() {
if (this.fileInfo && this.fileInfo.mountType === 'external') {
return this.t('cidgravitygateway', 'Not on an external storage')
}
return this.t('cidgravitygateway', 'Not on an CIDgravity storage')
return this.t('cidgravitygateway', 'Not metadata available')
},
errorMessage() {
return this.isErrorMessageLocal
Expand All @@ -173,12 +160,7 @@ export default {
},
emptyContentDescription() {
const contentType = this.fileInfo.type === 'dir' ? 'directory' : 'file'
if (this.fileInfo && this.fileInfo.mountType === 'external') {
return this.t('cidgravitygateway', 'This {contentType} is not on an external storage. To display metadata, you must browse files on external storage', { contentType })
}
return this.t('cidgravitygateway', 'This {contentType} is not on an CIDgravity storage type. To display metadata, you must browse files on external storage', { contentType })
return this.t('cidgravitygateway', 'This {contentType} is not located on a CIDgravity external storage.', { contentType })
},
shortenedCid() {
if (this.fileMetadata.result.file.cid !== null && this.fileMetadata.result.file.cid !== '' && this.fileMetadata.result.file.cid !== undefined) {
Expand Down Expand Up @@ -251,8 +233,7 @@ export default {
this.externalStorageConfiguration = config
this.isCidgravityStorageLocal = true
// parse default ipfs gateway to get hostname only
// if not in options, set to custom value
// only list of gateway, not custom value here
const parsedUrl = new URL(this.externalStorageConfiguration.default_ipfs_gateway)
if (this.ipfsGatewayOptions.some(e => e.link === this.externalStorageConfiguration.default_ipfs_gateway)) {
Expand All @@ -261,12 +242,6 @@ export default {
label: parsedUrl.hostname,
link: this.externalStorageConfiguration.default_ipfs_gateway,
}
} else {
this.ipfsGateway = {
id: 'Custom gateway',
label: 'Custom gateway',
link: this.externalStorageConfiguration.default_ipfs_gateway,
}
}
},
loadFileMetadata() {
Expand Down Expand Up @@ -332,17 +307,6 @@ export default {
}
}
.ipfs-custom-gateway-input {
display: flex;
flex-direction: column;
margin-bottom: 10px;
&__input {
width: 100%;
margin: 10px 0;
}
}
.menu-entry__internal {
.entry-icon {
width: 32px;
Expand Down

0 comments on commit 2d5a485

Please sign in to comment.