From: Jeremy Benoist Date: Sun, 2 Oct 2016 09:05:10 +0000 (+0200) Subject: Merge pull request #2324 from wallabag/edit-tagging-rule X-Git-Tag: 2.1.0~11 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=6e5e27ab078527cb68c2e7a37512d050fd330258;hp=2455472e26fe06bf14d2ec74534de7bd2e542249;p=github%2Fwallabag%2Fwallabag.git Merge pull request #2324 from wallabag/edit-tagging-rule Add ability to edit a tagging rule --- diff --git a/app/config/services.yml b/app/config/services.yml index 76bbce27..a57ef0f3 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -21,6 +21,7 @@ services: - "@wallabag_core.tag_repository" - "@security.token_storage" - "%wallabag_core.cache_lifetime%" + - "@translator" tags: - { name: twig.extension } diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 98ccfb1d..628cdbdb 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -45,6 +45,7 @@ footer: # social: 'Social' # powered_by: 'powered by' about: 'Om' + # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day! config: page_title: 'Opsætning' @@ -352,7 +353,7 @@ import: # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" # firefox: # page_title: 'Import > Firefox' - # description: "This importer will import all your Firefox bookmarks.

For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." + # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." # how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched." #chrome: # page_title: 'Import > Chrome' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 1dcd7dbe..2e683b8c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -45,6 +45,7 @@ footer: social: 'Soziales' powered_by: 'angetrieben von' about: 'Über' + # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day! config: page_title: 'Einstellungen' @@ -352,7 +353,7 @@ import: # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" firefox: page_title: 'Aus Firefox importieren' - # description: "This importer will import all your Firefox bookmarks.

For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." + # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." # how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched." chrome: page_title: 'Aus Chrome importieren' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index e75166bf..d629312c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -45,6 +45,7 @@ footer: social: 'Social' powered_by: 'powered by' about: 'About' + stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day! config: page_title: 'Config' @@ -352,7 +353,7 @@ import: enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" firefox: page_title: 'Import > Firefox' - description: "This importer will import all your Firefox bookmarks.

For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." + description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched." chrome: page_title: 'Import > Chrome' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 0884e9e6..860c466f 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -45,6 +45,7 @@ footer: social: 'Social' powered_by: 'funciona por' about: 'Acerca de' + # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day! config: page_title: 'Configuración' @@ -352,7 +353,7 @@ import: # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" firefox: page_title: 'Importar > Firefox' - # description: "This importer will import all your Firefox bookmarks.

For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." + # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." # how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched." chrome: page_title: 'Importar > Chrome' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index 1d30d5b2..6e02010c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -45,6 +45,7 @@ footer: social: 'شبکه‌های اجتماعی' powered_by: 'توانمند با' about: 'درباره' + # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day! config: page_title: 'پیکربندی' @@ -352,7 +353,7 @@ import: # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" firefox: page_title: 'درون‌ریزی > Firefox' - # description: "This importer will import all your Firefox bookmarks.

For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." + # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." # how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched." chrome: page_title: 'درون‌ریزی > Chrome' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index c3647731..0eeda011 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -45,6 +45,7 @@ footer: social: 'Social' powered_by: 'propulsé par' about: 'À propos' + stats: Depuis le %user_creation% vous avez lu %nb_archives% articles. Ce qui fait %per_day% par jour ! config: page_title: 'Configuration' @@ -352,7 +353,7 @@ import: enabled: "Les imports sont asynchrones. Une fois l'import commencé un worker externe traitera les messages un par un. Le service activé est :" firefox: page_title: 'Import > Firefox' - description: "Cet outil va vous permettre d'importer tous vos marques-pages de Firefox.

Pour Firefox, ouvrez le panneau des marques-pages (Ctrl+Maj+O), puis dans « Importation et sauvegarde », choisissez « Sauvegarde... ». Vous allez récupérer un fichier .json.

" + description: "Cet outil va vous permettre d'importer tous vos marques-pages de Firefox. Ouvrez le panneau des marques-pages (Ctrl+Maj+O), puis dans « Importation et sauvegarde », choisissez « Sauvegarde... ». Vous allez récupérer un fichier .json.

" how_to: "Choisissez le fichier de sauvegarde de vos marques-page et cliquez sur le bouton pour l'importer. Soyez avertis que le processus peut prendre un temps assez long car tous les articles doivent être récupérés en ligne." chrome: page_title: 'Import > Chrome' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 2c99e9a8..34f660f7 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml @@ -45,6 +45,7 @@ footer: social: 'Social' powered_by: 'powered by' about: 'About' + # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day! config: page_title: 'Configurazione' @@ -351,7 +352,7 @@ import: # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" firefox: page_title: 'Importa da > Firefox' - # description: "This importer will import all your Firefox bookmarks.

For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." + # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." # how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched." chrome: page_title: 'Importa da > Chrome' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index ebebcbc0..bcc59b29 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -19,14 +19,14 @@ menu: unread: 'Pas legits' starred: 'Favorits' archive: 'Legits' - all_articles: 'Tots los articles' + all_articles: 'Totes los articles' config: 'Configuracion' tags: 'Etiquetas' internal_settings: 'Configuracion interna' import: 'Importar' howto: 'Ajuda' developer: 'Desvolopador' - logout: 'Déconnexion' + logout: 'Desconnexion' about: 'A prepaus' search: 'Cercar' save_link: 'Enregistrar un novèl article' @@ -45,9 +45,10 @@ footer: social: 'Social' powered_by: 'propulsat per' about: 'A prepaus' - page_title: 'Configuracion' + # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day! config: + page_title: 'Configuracion' tab_menu: settings: 'Paramètres' rss: 'RSS' @@ -72,8 +73,8 @@ config: form_rss: description: "Los fluxes RSS fornits per wallabag vos permeton de legir vòstres articles salvagardats dins vòstre lector de fluxes preferit. Per los poder emplegar, vos cal, d'en primièr crear un geton." token_label: 'Geton RSS' - no_token: 'Aucun jeton généré' - token_create: 'Pas cap de geton generat' + no_token: 'Pas cap de geton generat' + token_create: 'Creatz vòstre geton' token_reset: 'Reïnicializatz vòstre geton' rss_links: 'URL de vòstres fluxes RSS' rss_link: @@ -188,7 +189,7 @@ entry: re_fetch_content: 'Tornar cargar lo contengut' delete: 'Suprimir' add_a_tag: 'Ajustar una etiqueta' - share_content: 'Partatjar' + share_content: 'Partejar' share_email_label: 'Corrièl' public_link: 'ligam public' delete_public_link: 'suprimir lo ligam public' @@ -225,7 +226,7 @@ about: developped_by: 'Desvolopat per' website: 'Site web' many_contributors: 'E un fum de contributors ♥ sur Github' - project_website: 'Site web del projète' + project_website: 'Site web del projècte' license: 'Licéncia' version: 'Version' getting_help: @@ -246,7 +247,7 @@ about: howto: page_title: 'Ajuda' - page_description: "I a mai d'un biai d'enregistrar un article :" + page_description: "I a mai d'un biais d'enregistrar un article :" top_menu: browser_addons: 'Extensions de navigator' mobile_apps: 'Aplicacions mobil' @@ -345,26 +346,26 @@ import: page_title: 'Importar > Wallabag v2' description: "Aquesta aisina importarà totas vòstras donadas d'una instància mai de wallabag v2. Anatz dins totes vòstres articles, puèi, sus la barra laterala, clicatz sus \"JSON\". Traparatz un fichièr \"All articles.json\"" readability: - page_title: 'Importer > Readability' + page_title: 'Importar > Readability' description: "Aquesta aisina importarà totas vòstres articles de Readability. Sus la pagina de l'aisina (https://www.readability.com/tools/), clicatz sus \"Export your data\" dins la seccion \"Data Export\". Recebretz un corrièl per telecargar un json (qu'acaba pas amb un .json de fach)." how_to: "Mercés de seleccionar vòstre Readability fichièr e de clicar sul boton dejós per lo telecargar e l'importar." worker: - # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" + enabled: "L'importacion se fa de manièra asincròna. Un còp l'importacion lançada, una aisina externa s'ocuparà dels messatges un per un. Lo servici actual es : " firefox: - page_title: 'Importer > Firefox' - # description: "This importer will import all your Firefox bookmarks.

For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." - # how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched." + page_title: 'Importar > Firefox' + description: "Aquesta aisina importarà totas vòstres favorits de Firefox. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." + how_to: "Mercés de causir lo fichièr de salvagarda e de clicar sul boton dejós per l'importar. Notatz que lo tractament pòt durar un moment ja que totes los articles an d'èsser recuperats." chrome: - page_title: 'Importer > Chrome' - # description: "This importer will import all your Chrome bookmarks. The location of the file depends on your operating system :

Once you got there, copy the Bookmarks file someplace you'll find.
Note that if you have Chromium instead of Chrome, you'll have to correct paths accordingly.

" - # how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched." + page_title: 'Importar > Chrome' + description: "Aquesta aisina importarà totas vòstres favorits de Chrome. L'emplaçament del fichièr depend de vòstre sistèma operatiu : Un còp enlà, copiatz lo fichièr de favorits dins un endrech que volètz.
Notatz que s'avètz Chromium al lòc de Chrome, vos cal cambiar lo camin segon aquesta situacion.

" + how_to: "Mercés de causir lo fichièr de salvagarda e de clicar sul boton dejós per l'importar. Notatz que lo tractament pòt durar un moment ja que totes los articles an d'èsser recuperats." instapaper: - page_title: 'Importer > Instapaper' - # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").' - # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.' + page_title: 'Importar > Instapaper' + description: "Aquesta aisina importarà totas vòstres articles d'Instapaper. Sus la pagina de paramètres (https://www.instapaper.com/user), clicatz sus \"Download .CSV file\" dins la seccion \"Export\". Un fichièr CSV serà telecargat (aital \"instapaper-export.csv\")." + how_to: "Mercés de causir vòstre fichièr Instapaper e de clicar sul boton dejós per lo telecargar e l'importar" developer: - page_title: 'Desvolopador' + page_title: 'Desvolopaire' welcome_message: "Benvenguda sus l'API de wallabag" documentation: 'Documentacion' how_to_first_app: 'Cossí crear vòstra primièra aplicacion' @@ -388,16 +389,18 @@ developer: page_title: 'Desvlopador > Novèl client' page_description: "Anatz crear un novèl client. Mercés de cumplir l'url de redireccion cap a vòstra aplicacion." form: + name_label: "Nom del client" redirect_uris_label: 'URLs de redireccion' save_label: 'Crear un novèl client' action_back: 'Retorn' client_parameter: page_title: 'Desvolopador > Los paramètres de vòstre client' page_description: 'Vaquí los paramètres de vòstre client' + field_name: 'Nom del client' field_id: 'ID Client' field_secret: 'Clau secreta' back: 'Retour' - read_howto: 'Legir \"cossí crear ma primièra aplicacion\"' + read_howto: 'Legir "cossí crear ma primièra aplicacion"' howto: page_title: 'Desvolopador > Cossí crear ma primièra aplicacion' description: @@ -427,10 +430,10 @@ flashes: notice: entry_already_saved: 'Article ja salvargardat lo %date%' entry_saved: 'Article enregistrat' - # entry_saved_failed: 'Entry saved but fetching content failed' + entry_saved_failed: 'Article salvat mai fracàs de la recuperacion del contengut' entry_updated: 'Article mes a jorn' entry_reloaded: 'Article recargat' - # entry_reload_failed: 'Entry reloaded but fetching content failed' + entry_reload_failed: "L'article es estat cargat de nòu mai la recuperacion del contengut a fracassat" entry_archived: 'Article marcat coma legit' entry_unarchived: 'Article marcat coma pas legit' entry_starred: 'Article apondut dins los favorits' @@ -444,10 +447,10 @@ flashes: failed: "L'importacion a fracassat, mercés de tornar ensajar" failed_on_file: "Errorr pendent du tractament de l'import. Mercés de verificar vòstre fichièr." summary: "Rapòrt d'import: %imported% importats, %skipped% ja presents." - # summary_with_queue: 'Import summary: %queued% queued.' + summary_with_queue: "Rapòrt d'import : %queued% en espèra de tractament." error: - # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like we can't connect to it. Please check Redis configuration. - # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like we can't connect to it. Please check RabbitMQ configuration. + redis_enabled_not_installed: "Redis es capable d'importar de manièra asincròna mai sembla que podèm pas nos conectar amb el. Mercés de verificar la configuracion de Redis." + rabbit_enabled_not_installed: "RabbitMQ es capable d'importar de manièra asincròna mai sembla que podèm pas nos conectar amb el. Mercés de verificar la configuracion de RabbitMQ." developer: notice: client_created: 'Novèl client creat' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 0a76b673..ce5ebab9 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -45,6 +45,7 @@ footer: social: 'Społeczność' powered_by: 'Kontrolowany przez' about: 'O nas' + # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day! config: page_title: 'Konfiguracja' @@ -352,7 +353,7 @@ import: enabled: "Import jest wykonywany asynchronicznie. Od momentu rozpoczęcia importu, zewnętrzna usługa może zajmować się na raz tylko jednym zadaniem. Bieżącą usługą jest:" firefox: page_title: 'Import > Firefox' - description: "Ten importer zaimportuje wszystkie twoje zakładki z Firefoksa.

Dla Firefoksa, idź do twoich zakładek (Ctrl+Shift+O), następnie w \"Import i kopie zapasowe\", wybierz \"Utwórz kopię zapasową...\". Uzyskasz plik .json." + description: "Ten importer zaimportuje wszystkie twoje zakładki z Firefoksa. Idź do twoich zakładek (Ctrl+Shift+O), następnie w \"Import i kopie zapasowe\", wybierz \"Utwórz kopię zapasową...\". Uzyskasz plik .json." how_to: "Wybierz swój plik z zakładkami i naciśnij poniższy przycisk, aby je zaimportować. Może to zająć dłuższą chwilę, zanim wszystkie artykuły zostaną przeniesione." chrome: page_title: 'Import > Chrome' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index d107a96e..a54efb4c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -45,6 +45,7 @@ footer: # social: 'Social' # powered_by: 'powered by' about: 'Despre' + # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day! config: page_title: 'Configurație' @@ -352,7 +353,7 @@ import: # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" # firefox: # page_title: 'Import > Firefox' - # description: "This importer will import all your Firefox bookmarks.

For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." + # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." # how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched." # chrome: # page_title: 'Import > Chrome' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 8bc0c4b9..e46c17c8 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml @@ -45,6 +45,7 @@ footer: social: 'Sosyal' powered_by: 'powered by' about: 'Hakkımızda' + # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day! config: page_title: 'Yapılandırma' @@ -351,7 +352,7 @@ import: # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" firefox: page_title: 'İçe Aktar > Firefox' - # description: "This importer will import all your Firefox bookmarks.

For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." + # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." # how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched." chrome: page_title: 'İçe Aktar > Chrome' diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig index df05e2a4..b2d77c2e 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig @@ -122,8 +122,19 @@

diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php index fb4c7412..783cde3e 100644 --- a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php +++ b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php @@ -5,6 +5,7 @@ namespace Wallabag\CoreBundle\Twig; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Wallabag\CoreBundle\Repository\EntryRepository; use Wallabag\CoreBundle\Repository\TagRepository; +use Symfony\Component\Translation\TranslatorInterface; class WallabagExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface { @@ -12,13 +13,15 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa private $entryRepository; private $tagRepository; private $lifeTime; + private $translator; - public function __construct(EntryRepository $entryRepository = null, TagRepository $tagRepository = null, TokenStorageInterface $tokenStorage = null, $lifeTime = 0) + public function __construct(EntryRepository $entryRepository, TagRepository $tagRepository, TokenStorageInterface $tokenStorage, $lifeTime, TranslatorInterface $translator) { $this->entryRepository = $entryRepository; $this->tagRepository = $tagRepository; $this->tokenStorage = $tokenStorage; $this->lifeTime = $lifeTime; + $this->translator = $translator; } public function getFilters() @@ -33,6 +36,7 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa return array( new \Twig_SimpleFunction('count_entries', [$this, 'countEntries']), new \Twig_SimpleFunction('count_tags', [$this, 'countTags']), + new \Twig_SimpleFunction('display_stats', [$this, 'displayStats']), ); } @@ -107,6 +111,40 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa return $this->tagRepository->countAllTags($user->getId()); } + /** + * Display a single line about reading stats. + * + * @return string + */ + public function displayStats() + { + $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; + + if (null === $user || !is_object($user)) { + return 0; + } + + $query = $this->entryRepository->getBuilderForArchiveByUser($user->getId()) + ->select('e.id') + ->groupBy('e.id') + ->getQuery(); + + $query->useQueryCache(true); + $query->useResultCache(true); + $query->setResultCacheLifetime($this->lifeTime); + + $nbArchives = count($query->getArrayResult()); + + $interval = $user->getCreatedAt()->diff(new \DateTime('now')); + $nbDays = (int) $interval->format('%a') ?: 1; + + return $this->translator->trans('footer.stats', [ + '%user_creation%' => $user->getCreatedAt()->format('F jS, Y'), + '%nb_archives%' => $nbArchives, + '%per_day%' => round($nbArchives / $nbDays, 2), + ]); + } + public function getName() { return 'wallabag_extension'; diff --git a/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php b/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php index 8ec2a75a..b1c8c946 100644 --- a/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php +++ b/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php @@ -8,7 +8,23 @@ class WallabagExtensionTest extends \PHPUnit_Framework_TestCase { public function testRemoveWww() { - $extension = new WallabagExtension(); + $entryRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') + ->disableOriginalConstructor() + ->getMock(); + + $tagRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository') + ->disableOriginalConstructor() + ->getMock(); + + $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface') + ->disableOriginalConstructor() + ->getMock(); + + $translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface') + ->disableOriginalConstructor() + ->getMock(); + + $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator); $this->assertEquals('lemonde.fr', $extension->removeWww('www.lemonde.fr')); $this->assertEquals('lemonde.fr', $extension->removeWww('lemonde.fr'));