Fix filters & add l10n
Some checks failed
repod / php (push) Waiting to run
repod / nodejs (push) Waiting to run
repod / xml (push) Has been cancelled

This commit is contained in:
Michel Roux 2024-01-10 15:25:54 +01:00
parent 7af1548624
commit 310a2b28f1
21 changed files with 294 additions and 35 deletions

View File

@ -1,7 +1,8 @@
.idea
*.iml *.iml
/vendor/ .idea
/build/
node_modules/
/.php-cs-fixer.cache /.php-cs-fixer.cache
/.php_cs.cache
/build/
/vendor/
js/ js/
node_modules/

9
.eslintignore Normal file
View File

@ -0,0 +1,9 @@
*.iml
.idea
/.php-cs-fixer.cache
/.php_cs.cache
/build/
/vendor/
js/
node_modules/
l10n/

8
.l10nignore Normal file
View File

@ -0,0 +1,8 @@
*.iml
.idea
/.php-cs-fixer.cache
/.php_cs.cache
build/
vendor/
js/
node_modules/

View File

@ -155,10 +155,24 @@ appstore:
../$(app_name) ../$(app_name)
# Start a nextcloud server on Docker to kickstart developement # Start a nextcloud server on Docker to kickstart developement
.PHONY: appstore .PHONY: dev
dev: build dev: build
docker stop repod || true docker stop repod || true
docker rm repod || true docker rm repod || true
docker build -t repod . docker build -t repod .
docker run -itd --name repod -v $(CURDIR):/var/www/html/apps/repod -p 80:80 repod docker run -itd --name repod -v $(CURDIR):/var/www/html/apps/repod -p 80:80 repod
npm run watch npm run watch
# Generate translations
.PHONY: l10n
l10n:
docker run \
-v $(CURDIR):/app \
--entrypoint php \
nextcloudci/translations \
/translationtool.phar create-pot-files
docker run \
-v $(CURDIR):/app \
--entrypoint php \
nextcloudci/translations \
/translationtool.phar convert-po-files

23
l10n/fr.js Normal file
View File

@ -0,0 +1,23 @@
OC.L10N.register(
"repod",
{
"Add a RSS link" : "Ajouter un lien RSS",
"Could not fetch search results" : "Impossible de récupérer les resultats de la recherche",
"Suggests by fyyd" : "Suggestions via fyyd",
"Could not fetch tops" : "Impossible de récupérer les tops",
"Subscribe" : "S'abonner",
"Error while adding the feed" : "Erreur lors de l'ajout du flux",
"Play" : "Lecture",
"Stop" : "Arrêter",
"Could not fetch episodes" : "Impossible de récuprer les épisodes",
"Download" : "Télécharger",
"Delete" : "Supprimer",
"Error while removing the feed" : "Erreur lors de la suppression du flux",
"Add a podcast" : "Ajouter un podcast",
"Could not fetch subscriptions" : "Impossible de récupérer les flux",
"Find a podcast" : "Chercher un podcast",
"Error loading feed" : "Erreur lors du chargement du flux",
"Missing required app" : "Une application requise est manquante",
"Install GPodder Sync" : "Installer GPodder Sync"
},
"");

21
l10n/fr.json Normal file
View File

@ -0,0 +1,21 @@
{ "translations": {
"Add a RSS link" : "Ajouter un lien RSS",
"Could not fetch search results" : "Impossible de récupérer les resultats de la recherche",
"Suggests by fyyd" : "Suggestions via fyyd",
"Could not fetch tops" : "Impossible de récupérer les tops",
"Subscribe" : "S'abonner",
"Error while adding the feed" : "Erreur lors de l'ajout du flux",
"Play" : "Lecture",
"Stop" : "Arrêter",
"Could not fetch episodes" : "Impossible de récuprer les épisodes",
"Download" : "Télécharger",
"Delete" : "Supprimer",
"Error while removing the feed" : "Erreur lors de la suppression du flux",
"Add a podcast" : "Ajouter un podcast",
"Could not fetch subscriptions" : "Impossible de récupérer les flux",
"Find a podcast" : "Chercher un podcast",
"Error loading feed" : "Erreur lors du chargement du flux",
"Missing required app" : "Une application requise est manquante",
"Install GPodder Sync" : "Installer GPodder Sync"
},"pluralForm" :""
}

View File

@ -1,6 +1,6 @@
<template> <template>
<ul> <ul>
<NcAppNavigationNewItem :name="t('Add a RSS link')" <NcAppNavigationNewItem :name="t('repod', 'Add a RSS link')"
@new-item="addSubscription"> @new-item="addSubscription">
<template #icon> <template #icon>
<Plus :size="20" /> <Plus :size="20" />

View File

@ -67,7 +67,7 @@ export default {
} }
} catch (e) { } catch (e) {
console.error(e) console.error(e)
showError(t('Could not fetch search results')) showError(t('repod', 'Could not fetch search results'))
} finally { } finally {
if (this.feeds) { if (this.feeds) {
this.loading = false this.loading = false

View File

@ -10,7 +10,7 @@
</li> </li>
</ul> </ul>
<p v-if="!loading" class="caption"> <p v-if="!loading" class="caption">
{{ t('Suggests by fyyd') }} {{ t('repod', 'Suggests by fyyd') }}
</p> </p>
</div> </div>
</template> </template>
@ -41,7 +41,7 @@ export default {
this.tops = toplist.data this.tops = toplist.data
} catch (e) { } catch (e) {
console.error(e) console.error(e)
showError(t('Could not fetch tops')) showError(t('repod', 'Could not fetch tops'))
} finally { } finally {
this.loading = false this.loading = false
} }

View File

@ -15,11 +15,11 @@
</a> </a>
<br><br> <br><br>
<p> <p>
<small>{{ description | stripHTML }}</small> <small>{{ strippedDescription }}</small>
</p> </p>
</div> </div>
<NcAppNavigationNew v-if="!isSubscribed" <NcAppNavigationNew v-if="!isSubscribed"
:text="t('Subscribe')" :text="t('repod', 'Subscribe')"
@click="addSubscription"> @click="addSubscription">
<template #icon> <template #icon>
<Plus :size="20" /> <Plus :size="20" />
@ -73,6 +73,11 @@ export default {
isSubscribed() { isSubscribed() {
return this.$store.state.subscriptions.subscriptions.includes(this.url) return this.$store.state.subscriptions.subscriptions.includes(this.url)
}, },
strippedDescription() {
const pre = document.createElement('pre')
pre.innerHTML = this.description
return pre.textContent || pre.innerText || ''
},
}, },
methods: { methods: {
async addSubscription() { async addSubscription() {
@ -80,7 +85,7 @@ export default {
await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [this.url], remove: [] }) await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [this.url], remove: [] })
} catch (e) { } catch (e) {
console.error(e) console.error(e)
showError(t('Error while adding the feed')) showError(t('repod', 'Error while adding the feed'))
} }
this.$store.dispatch('subscriptions/fetch') this.$store.dispatch('subscriptions/fetch')

View File

@ -24,13 +24,13 @@
<template #icon> <template #icon>
<PlayButton :size="20" /> <PlayButton :size="20" />
</template> </template>
{{ t('Play') }} {{ t('repod', 'Play') }}
</NcActionButton> </NcActionButton>
<NcActionButton v-if="isCurrentEpisode(episode)" @click="load(null)"> <NcActionButton v-if="isCurrentEpisode(episode)" @click="load(null)">
<template #icon> <template #icon>
<StopButton :size="20" /> <StopButton :size="20" />
</template> </template>
{{ t('Stop') }} {{ t('repod', 'Stop') }}
</NcActionButton> </NcActionButton>
</template> </template>
</NcListItem> </NcListItem>
@ -96,7 +96,7 @@ export default {
this.episodes = [...episodes.data].sort((a, b) => a.episodePubDate.date < b.episodePubDate.date) this.episodes = [...episodes.data].sort((a, b) => a.episodePubDate.date < b.episodePubDate.date)
} catch (e) { } catch (e) {
console.error(e) console.error(e)
showError(t('Could not fetch episodes')) showError(t('repod', 'Could not fetch episodes'))
} finally { } finally {
this.loading = false this.loading = false
} }

View File

@ -18,7 +18,7 @@
<template #icon> <template #icon>
<Download :size="20" /> <Download :size="20" />
</template> </template>
{{ t('Download') }} {{ t('repod', 'Download') }}
</NcButton> </NcButton>
</div> </div>
</div> </div>

View File

@ -3,7 +3,7 @@
<a :href="player.episode.episodeLink" target="_blank"> <a :href="player.episode.episodeLink" target="_blank">
<strong>{{ player.episode.episodeName }}</strong> <strong>{{ player.episode.episodeName }}</strong>
</a> </a>
<router-link :to="player.podcastUrl"> <router-link :to="toUrl(player.podcastUrl)">
<i>{{ player.episode.podcastName }}</i> <i>{{ player.episode.podcastName }}</i>
</router-link> </router-link>
</div> </div>
@ -17,6 +17,11 @@ export default {
return this.$store.state.player return this.$store.state.player
}, },
}, },
methods: {
toUrl(url) {
return `/${btoa(url)}`
},
},
} }
</script> </script>

View File

@ -14,7 +14,7 @@
<template #icon> <template #icon>
<Delete :size="20" /> <Delete :size="20" />
</template> </template>
{{ t('Delete') }} {{ t('repod', 'Delete') }}
</NcActionButton> </NcActionButton>
</template> </template>
</NcAppNavigationItem> </NcAppNavigationItem>
@ -73,7 +73,7 @@ export default {
await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [], remove: [this.url] }) await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [], remove: [this.url] })
} catch (e) { } catch (e) {
console.error(e) console.error(e)
showError(t('Error while removing the feed')) showError(t('repod', 'Error while removing the feed'))
} finally { } finally {
this.loading = false this.loading = false
this.$store.dispatch('subscriptions/fetch') this.$store.dispatch('subscriptions/fetch')

View File

@ -2,7 +2,7 @@
<NcAppNavigation> <NcAppNavigation>
<NcAppContentList> <NcAppContentList>
<router-link to="/"> <router-link to="/">
<NcAppNavigationNew :text="t('Add a podcast')"> <NcAppNavigationNew :text="t('repod', 'Add a podcast')">
<template #icon> <template #icon>
<Plus :size="20" /> <Plus :size="20" />
</template> </template>
@ -55,7 +55,7 @@ export default {
await this.$store.dispatch('subscriptions/fetch') await this.$store.dispatch('subscriptions/fetch')
} catch (e) { } catch (e) {
console.error(e) console.error(e)
showError(t('Could not fetch subscriptions')) showError(t('repod', 'Could not fetch subscriptions'))
} finally { } finally {
this.loading = false this.loading = false
} }

View File

@ -1,4 +1,4 @@
import { translate, translatePlural } from '@nextcloud/l10n' import { translatePlural as n, translate as t } from '@nextcloud/l10n'
import App from './App.vue' import App from './App.vue'
import Vue from 'vue' import Vue from 'vue'
import { generateFilePath } from '@nextcloud/router' import { generateFilePath } from '@nextcloud/router'
@ -8,17 +8,8 @@ import store from './store/main.js'
// eslint-disable-next-line // eslint-disable-next-line
__webpack_public_path__ = generateFilePath(appName, '', 'js/') __webpack_public_path__ = generateFilePath(appName, '', 'js/')
const t = (...args) => translate('repod', ...args)
const n = (...args) => translatePlural('repod', ...args)
Vue.mixin({ methods: { t, n } }) Vue.mixin({ methods: { t, n } })
Vue.filter('stripHTML', (value) => {
const div = document.createElement('div')
div.innerHTML = value
return div.textContent || div.innerText || ''
})
export default new Vue({ export default new Vue({
el: '#content', el: '#content',
router, router,

View File

@ -1,7 +1,7 @@
<template> <template>
<NcAppContent class="main"> <NcAppContent class="main">
<NcTextField class="search" <NcTextField class="search"
:label="t('Find a podcast')" :label="t('repod', 'Find a podcast')"
:value.sync="search"> :value.sync="search">
<Magnify :size="20" /> <Magnify :size="20" />
</NcTextField> </NcTextField>

View File

@ -1,7 +1,7 @@
<template> <template>
<NcAppContent> <NcAppContent>
<Loading v-if="loading" /> <Loading v-if="loading" />
<NcEmptyContent v-if="failed" :name="t('Error loading feed')"> <NcEmptyContent v-if="failed" :name="t('repod', 'Error loading feed')">
<template #icon> <template #icon>
<Alert /> <Alert />
</template> </template>

View File

@ -1,12 +1,12 @@
<template> <template>
<NcAppContent> <NcAppContent>
<NcEmptyContent :name="t('Missing required app')"> <NcEmptyContent :name="t('repod', 'Missing required app')">
<template #icon> <template #icon>
<Alert /> <Alert />
</template> </template>
<template #action> <template #action>
<NcButton :href="gPodderSyncUrl"> <NcButton :href="gPodderSyncUrl">
{{ t('Install GPodder Sync') }} {{ t('repod', 'Install GPodder Sync') }}
</NcButton> </NcButton>
</template> </template>
</NcEmptyContent> </NcEmptyContent>

View File

@ -0,0 +1,72 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the Nextcloud package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Nextcloud 3.14159\n"
"Report-Msgid-Bugs-To: translations\\@example.com\n"
"POT-Creation-Date: 2024-01-10 08:48+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "Add a RSS link"
msgstr "Ajouter un lien RSS"
msgid "Could not fetch search results"
msgstr "Impossible de récupérer les resultats de la recherche"
msgid "Suggests by fyyd"
msgstr "Suggestions via fyyd"
msgid "Could not fetch tops"
msgstr "Impossible de récupérer les tops"
msgid "Subscribe"
msgstr "S'abonner"
msgid "Error while adding the feed"
msgstr "Erreur lors de l'ajout du flux"
msgid "Play"
msgstr "Lecture"
msgid "Stop"
msgstr "Arrêter"
msgid "Could not fetch episodes"
msgstr "Impossible de récuprer les épisodes"
msgid "Download"
msgstr "Télécharger"
msgid "Delete"
msgstr "Supprimer"
msgid "Error while removing the feed"
msgstr "Erreur lors de la suppression du flux"
msgid "Add a podcast"
msgstr "Ajouter un podcast"
msgid "Could not fetch subscriptions"
msgstr "Impossible de récupérer les flux"
msgid "Find a podcast"
msgstr "Chercher un podcast"
msgid "Error loading feed"
msgstr "Erreur lors du chargement du flux"
msgid "Missing required app"
msgstr "Une application requise est manquante"
msgid "Install GPodder Sync"
msgstr "Installer GPodder Sync"

View File

@ -0,0 +1,110 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the Nextcloud package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Nextcloud 3.14159\n"
"Report-Msgid-Bugs-To: translations\\@example.com\n"
"POT-Creation-Date: 2024-01-10 14:22+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: /app/specialAppInfoFakeDummyForL10nScript.php:2
msgid "RePod"
msgstr ""
#: /app/specialAppInfoFakeDummyForL10nScript.php:3
msgid "🔊 Browse, manage and listen to podcasts"
msgstr ""
#: /app/specialAppInfoFakeDummyForL10nScript.php:4
msgid ""
"# Features\n"
"- 🔍 Browse and subscribe huge collection of podcasts\n"
"- 🔊 Listen to episodes directly in Nextcloud\n"
"- 🌐 Sync your activity with [AntennaPod](https://antennapod.org/)\n"
"\n"
"# Requirements\n"
"You need to have [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) "
"installed to use this app!"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:1
msgid "Add a RSS link"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:2
msgid "Could not fetch search results"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:3
msgid "Suggests by fyyd"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:4
msgid "Could not fetch tops"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:5
msgid "Subscribe"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:6
msgid "Error while adding the feed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:7
msgid "Play"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:8
msgid "Stop"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:9
msgid "Could not fetch episodes"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:10
msgid "Download"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:11
msgid "Delete"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:12
msgid "Error while removing the feed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:13
msgid "Add a podcast"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:14
msgid "Could not fetch subscriptions"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:15
msgid "Find a podcast"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:16
msgid "Error loading feed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:17
msgid "Missing required app"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:18
msgid "Install GPodder Sync"
msgstr ""