mirror of
https://github.com/wallabag/wallabag.git
synced 2025-01-11 09:25:25 +00:00
Merge pull request #1767 from wallabag/v2-setting-for-reading-time
Setting for reading time
This commit is contained in:
commit
f39e94ace3
15 changed files with 103 additions and 7 deletions
|
@ -44,6 +44,7 @@ wallabag_core:
|
|||
theme: material
|
||||
language: en
|
||||
rss_limit: 50
|
||||
reading_speed: 1
|
||||
|
||||
wallabag_import:
|
||||
allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain']
|
||||
|
|
|
@ -21,6 +21,12 @@ Items per page
|
|||
|
||||
You can change the number of articles displayed on each page.
|
||||
|
||||
Reading speed
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
wallabag calculates a reading time for each article. You can define here, thanks to this list, if you are
|
||||
a fast or a slow reader. wallabag will recalculate the reading time for each article.
|
||||
|
||||
Language
|
||||
~~~~~~~~
|
||||
|
||||
|
|
|
@ -22,6 +22,11 @@ Nombre d'articles par page
|
|||
|
||||
Vous pouvez définir le nombre d'articles affichés sur chaque page.
|
||||
|
||||
Vitesse de lecture
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
wallabag calcule une durée de lecture pour chaque article. Vous pouvez définir ici, grâce à cette liste déroulante, si vous lisez plus ou moins vite. wallabag recalculera la durée de lecture de chaque article.
|
||||
|
||||
Langue
|
||||
~~~~~~
|
||||
|
||||
|
|
|
@ -222,6 +222,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
$config->setTheme($this->getContainer()->getParameter('wallabag_core.theme'));
|
||||
$config->setItemsPerPage($this->getContainer()->getParameter('wallabag_core.items_on_page'));
|
||||
$config->setRssLimit($this->getContainer()->getParameter('wallabag_core.rss_limit'));
|
||||
$config->setReadingSpeed($this->getContainer()->getParameter('wallabag_core.reading_speed'));
|
||||
$config->setLanguage($this->getContainer()->getParameter('wallabag_core.language'));
|
||||
|
||||
$em->persist($config);
|
||||
|
|
|
@ -25,6 +25,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
|
|||
|
||||
$adminConfig->setTheme('material');
|
||||
$adminConfig->setItemsPerPage(30);
|
||||
$adminConfig->setReadingSpeed(1);
|
||||
$adminConfig->setLanguage('en');
|
||||
|
||||
$manager->persist($adminConfig);
|
||||
|
@ -34,6 +35,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
|
|||
$bobConfig = new Config($this->getReference('bob-user'));
|
||||
$bobConfig->setTheme('default');
|
||||
$bobConfig->setItemsPerPage(10);
|
||||
$bobConfig->setReadingSpeed(1);
|
||||
$bobConfig->setLanguage('fr');
|
||||
|
||||
$manager->persist($bobConfig);
|
||||
|
@ -43,6 +45,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
|
|||
$emptyConfig = new Config($this->getReference('empty-user'));
|
||||
$emptyConfig->setTheme('material');
|
||||
$emptyConfig->setItemsPerPage(10);
|
||||
$emptyConfig->setReadingSpeed(1);
|
||||
$emptyConfig->setLanguage('en');
|
||||
|
||||
$manager->persist($emptyConfig);
|
||||
|
|
|
@ -29,6 +29,9 @@ class Configuration implements ConfigurationInterface
|
|||
->integerNode('rss_limit')
|
||||
->defaultValue(50)
|
||||
->end()
|
||||
->integerNode('reading_speed')
|
||||
->defaultValue(1)
|
||||
->end()
|
||||
->scalarNode('version')
|
||||
->end()
|
||||
->scalarNode('paypal_url')
|
||||
|
|
|
@ -19,6 +19,7 @@ class WallabagCoreExtension extends Extension
|
|||
$container->setParameter('wallabag_core.theme', $config['theme']);
|
||||
$container->setParameter('wallabag_core.language', $config['language']);
|
||||
$container->setParameter('wallabag_core.rss_limit', $config['rss_limit']);
|
||||
$container->setParameter('wallabag_core.reading_speed', $config['reading_speed']);
|
||||
$container->setParameter('wallabag_core.version', $config['version']);
|
||||
$container->setParameter('wallabag_core.paypal_url', $config['paypal_url']);
|
||||
|
||||
|
|
|
@ -73,6 +73,13 @@ class Config
|
|||
*/
|
||||
private $rssLimit;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="reading_speed", type="float", nullable=true)
|
||||
*/
|
||||
private $readingSpeed;
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
|
||||
*/
|
||||
|
@ -247,6 +254,30 @@ class Config
|
|||
return $this->rssLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set readingSpeed.
|
||||
*
|
||||
* @param float $readingSpeed
|
||||
*
|
||||
* @return Config
|
||||
*/
|
||||
public function setReadingSpeed($readingSpeed)
|
||||
{
|
||||
$this->readingSpeed = $readingSpeed;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get readingSpeed.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getReadingSpeed()
|
||||
{
|
||||
return $this->readingSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TaggingRule $rule
|
||||
*
|
||||
|
|
|
@ -35,6 +35,14 @@ class ConfigType extends AbstractType
|
|||
'choices_as_values' => true,
|
||||
))
|
||||
->add('items_per_page')
|
||||
->add('reading_speed', ChoiceType::class, array(
|
||||
'choices' => array(
|
||||
'I read ~100 words per minute' => '0.5',
|
||||
'I read ~200 words per minute' => '1',
|
||||
'I read ~300 words per minute' => '1.5',
|
||||
'I read ~400 words per minute' => '2',
|
||||
),
|
||||
))
|
||||
->add('language', ChoiceType::class, array(
|
||||
'choices' => array_flip($this->languages),
|
||||
'choices_as_values' => true,
|
||||
|
|
|
@ -38,6 +38,7 @@ RSS: 'RSS'
|
|||
Add a user: 'Créer un compte'
|
||||
Theme: 'Thème'
|
||||
Items per page: "Nombre d'articles par page"
|
||||
Reading speed: "Vitesse de lecture"
|
||||
Language: 'Langue'
|
||||
Save: 'Enregistrer'
|
||||
RSS token: 'Jeton RSS'
|
||||
|
@ -56,6 +57,12 @@ Repeat new password: 'Confirmez votre nouveau mot de passe'
|
|||
Username: "Nom d'utilisateur"
|
||||
Two factor authentication: "Double authentification"
|
||||
"Enabling two factor authentication means you'll receive an email with a code on every new untrusted connexion": "Activer l'authentification double-facteur veut dire que vous allez recevoir un code par email à chaque nouvelle connexion non approuvée."
|
||||
"I read ~100 words per minute": "Je lis environ 100 mots par minute"
|
||||
"I read ~200 words per minute": "Je lis environ 200 mots par minute"
|
||||
"I read ~300 words per minute": "Je lis environ 300 mots par minute"
|
||||
"I read ~400 words per minute": "Je lis environ 400 mots par minute"
|
||||
"You can use online tools to estimate your reading speed": "Vous pouvez utiliser un outil en ligne pour estimer votre vitesse de lecture"
|
||||
"like this one": "comme celui-ci"
|
||||
|
||||
# Tagging rules
|
||||
Tagging rules: "Règles de tag automatiques"
|
||||
|
|
|
@ -24,6 +24,15 @@
|
|||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="w500p inline">
|
||||
<div class="row">
|
||||
{{ form_label(form.config.reading_speed) }}
|
||||
{{ form_errors(form.config.reading_speed) }}
|
||||
{{ form_widget(form.config.reading_speed) }}
|
||||
<p>{% trans %}You can use online tools to estimate your reading speed{% endtrans %} (<a href="http://www.myreadspeed.com/calculate/">{% trans %}like this one{%endtrans%}</a>).</p>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="w500p inline">
|
||||
<div class="row">
|
||||
{{ form_label(form.config.language) }}
|
||||
|
|
|
@ -42,6 +42,15 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="input-field col s12">
|
||||
{{ form_label(form.config.reading_speed) }}
|
||||
{{ form_errors(form.config.reading_speed) }}
|
||||
{{ form_widget(form.config.reading_speed) }}
|
||||
<p>{% trans %}You can use online tools to estimate your reading speed{% endtrans %} (<a href="http://www.myreadspeed.com/calculate/">{% trans %}like this one{%endtrans%}</a>).</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="input-field col s12">
|
||||
{{ form_label(form.config.language) }}
|
||||
|
|
|
@ -50,8 +50,9 @@
|
|||
|
||||
<div class="estimatedTime grey-text">
|
||||
<span class="tool reading-time">
|
||||
{% if entry.readingTime > 0 %}
|
||||
{% trans with {'%readingTime%': entry.readingTime } %}estimated reading time: %readingTime% min{% endtrans %}
|
||||
{% set readingTime = entry.readingTime / app.user.config.readingSpeed %}
|
||||
{% if readingTime > 0 %}
|
||||
{% trans with {'%readingTime%': readingTime } %}estimated reading time: %readingTime% min{% endtrans %}
|
||||
{% else %}
|
||||
{% trans with {'%inferior%': '<small class="inferieur"><</small>'} %}estimated reading time: %inferior% 1 min{% endtrans %}
|
||||
{% endif %}
|
||||
|
|
|
@ -46,6 +46,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$data = array(
|
||||
'config[theme]' => 'baggy',
|
||||
'config[items_per_page]' => '30',
|
||||
'config[reading_speed]' => '0.5',
|
||||
'config[language]' => 'en',
|
||||
);
|
||||
|
||||
|
|
|
@ -425,11 +425,13 @@ class SymfonyRequirements extends RequirementCollection
|
|||
'Change the permissions of either "<strong>app/logs/</strong>" or "<strong>var/logs/</strong>" directory so that the web server can write into it.'
|
||||
);
|
||||
|
||||
$this->addPhpIniRequirement(
|
||||
'date.timezone', true, false,
|
||||
'date.timezone setting must be set',
|
||||
'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
|
||||
);
|
||||
if (version_compare($installedPhpVersion, '7.0.0', '<')) {
|
||||
$this->addPhpIniRequirement(
|
||||
'date.timezone', true, false,
|
||||
'date.timezone setting must be set',
|
||||
'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
|
||||
);
|
||||
}
|
||||
|
||||
if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
|
||||
$timezones = array();
|
||||
|
@ -677,6 +679,14 @@ class SymfonyRequirements extends RequirementCollection
|
|||
'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).'
|
||||
);
|
||||
|
||||
if (class_exists('Symfony\Component\Intl\Intl')) {
|
||||
$this->addRecommendation(
|
||||
\Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(),
|
||||
sprintf('intl ICU version installed on your system (%s) should match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()),
|
||||
'In most cases you should be fine, but please verify there is no inconsistencies between data provided by Symfony and the intl extension. See https://github.com/symfony/symfony/issues/15007 for an example of inconsistencies you might run into.'
|
||||
);
|
||||
}
|
||||
|
||||
$this->addPhpIniRecommendation(
|
||||
'intl.error_level',
|
||||
create_function('$cfgValue', 'return (int) $cfgValue === 0;'),
|
||||
|
|
Loading…
Reference in a new issue