From 310a2b28f1ee1d5d6b126daddeb0803da2f92f4b Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Wed, 10 Jan 2024 15:25:54 +0100 Subject: [PATCH] Fix filters & add l10n --- .dockerignore | 9 +- .eslintignore | 9 ++ .l10nignore | 8 ++ Makefile | 16 +++- l10n/fr.js | 23 +++++ l10n/fr.json | 21 +++++ src/components/Discover/AddRss.vue | 2 +- src/components/Discover/Search.vue | 2 +- src/components/Discover/TopList.vue | 4 +- src/components/Feed/Banner.vue | 11 ++- src/components/Feed/Episodes.vue | 6 +- src/components/Feed/Modal.vue | 2 +- src/components/Player/Infos.vue | 7 +- src/components/Sidebar/Item.vue | 4 +- src/components/Sidebar/Subscriptions.vue | 4 +- src/main.js | 11 +-- src/views/Discover.vue | 2 +- src/views/Feed.vue | 2 +- src/views/GPodder.vue | 4 +- translationfiles/fr/repod.po | 72 +++++++++++++++ translationfiles/templates/repod.pot | 110 +++++++++++++++++++++++ 21 files changed, 294 insertions(+), 35 deletions(-) create mode 100644 .eslintignore create mode 100644 .l10nignore create mode 100644 l10n/fr.js create mode 100644 l10n/fr.json create mode 100644 translationfiles/fr/repod.po create mode 100644 translationfiles/templates/repod.pot diff --git a/.dockerignore b/.dockerignore index bcbff2b..5fa8b99 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,8 @@ -.idea *.iml -/vendor/ -/build/ -node_modules/ +.idea /.php-cs-fixer.cache +/.php_cs.cache +/build/ +/vendor/ js/ +node_modules/ diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..a4e6f3b --- /dev/null +++ b/.eslintignore @@ -0,0 +1,9 @@ +*.iml +.idea +/.php-cs-fixer.cache +/.php_cs.cache +/build/ +/vendor/ +js/ +node_modules/ +l10n/ diff --git a/.l10nignore b/.l10nignore new file mode 100644 index 0000000..2ca12bf --- /dev/null +++ b/.l10nignore @@ -0,0 +1,8 @@ +*.iml +.idea +/.php-cs-fixer.cache +/.php_cs.cache +build/ +vendor/ +js/ +node_modules/ diff --git a/Makefile b/Makefile index 29c117e..846453c 100644 --- a/Makefile +++ b/Makefile @@ -155,10 +155,24 @@ appstore: ../$(app_name) # Start a nextcloud server on Docker to kickstart developement -.PHONY: appstore +.PHONY: dev dev: build docker stop repod || true docker rm repod || true docker build -t repod . docker run -itd --name repod -v $(CURDIR):/var/www/html/apps/repod -p 80:80 repod 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 diff --git a/l10n/fr.js b/l10n/fr.js new file mode 100644 index 0000000..5a84812 --- /dev/null +++ b/l10n/fr.js @@ -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" +}, +""); diff --git a/l10n/fr.json b/l10n/fr.json new file mode 100644 index 0000000..8274593 --- /dev/null +++ b/l10n/fr.json @@ -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" :"" +} \ No newline at end of file diff --git a/src/components/Discover/AddRss.vue b/src/components/Discover/AddRss.vue index 6339ccf..8de881f 100644 --- a/src/components/Discover/AddRss.vue +++ b/src/components/Discover/AddRss.vue @@ -1,6 +1,6 @@ @@ -73,7 +73,7 @@ export default { await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [], remove: [this.url] }) } catch (e) { console.error(e) - showError(t('Error while removing the feed')) + showError(t('repod', 'Error while removing the feed')) } finally { this.loading = false this.$store.dispatch('subscriptions/fetch') diff --git a/src/components/Sidebar/Subscriptions.vue b/src/components/Sidebar/Subscriptions.vue index 13e43da..3b3772d 100644 --- a/src/components/Sidebar/Subscriptions.vue +++ b/src/components/Sidebar/Subscriptions.vue @@ -2,7 +2,7 @@ - + @@ -55,7 +55,7 @@ export default { await this.$store.dispatch('subscriptions/fetch') } catch (e) { console.error(e) - showError(t('Could not fetch subscriptions')) + showError(t('repod', 'Could not fetch subscriptions')) } finally { this.loading = false } diff --git a/src/main.js b/src/main.js index c48ca10..7d5980f 100644 --- a/src/main.js +++ b/src/main.js @@ -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 Vue from 'vue' import { generateFilePath } from '@nextcloud/router' @@ -8,17 +8,8 @@ import store from './store/main.js' // eslint-disable-next-line __webpack_public_path__ = generateFilePath(appName, '', 'js/') -const t = (...args) => translate('repod', ...args) -const n = (...args) => translatePlural('repod', ...args) - 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({ el: '#content', router, diff --git a/src/views/Discover.vue b/src/views/Discover.vue index 82c9a0a..f70e6f5 100644 --- a/src/views/Discover.vue +++ b/src/views/Discover.vue @@ -1,7 +1,7 @@