mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-22 17:06:41 -06:00
Added translator and translations to GetVisitsCommand
This commit is contained in:
parent
cb99130c1e
commit
545fe7da70
Binary file not shown.
@ -1,8 +1,8 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Shlink 1.0\n"
|
"Project-Id-Version: Shlink 1.0\n"
|
||||||
"POT-Creation-Date: 2016-07-21 15:05+0200\n"
|
"POT-Creation-Date: 2016-07-21 15:28+0200\n"
|
||||||
"PO-Revision-Date: 2016-07-21 15:08+0200\n"
|
"PO-Revision-Date: 2016-07-21 15:32+0200\n"
|
||||||
"Last-Translator: \n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"Language: es_ES\n"
|
"Language: es_ES\n"
|
||||||
@ -38,3 +38,30 @@ msgstr "URL generada:"
|
|||||||
#, php-format
|
#, php-format
|
||||||
msgid "Provided URL \"%s\" is invalid. Try with a different one."
|
msgid "Provided URL \"%s\" is invalid. Try with a different one."
|
||||||
msgstr "La URL proporcionada \"%s\" e inválida. Prueba con una diferente."
|
msgstr "La URL proporcionada \"%s\" e inválida. Prueba con una diferente."
|
||||||
|
|
||||||
|
msgid "Returns the detailed visits information for provided short code"
|
||||||
|
msgstr "Devuelve la información detallada de visitas para el código corto proporcionado"
|
||||||
|
|
||||||
|
msgid "The short code which visits we want to get"
|
||||||
|
msgstr "El código corto del cual queremos obtener las visitas"
|
||||||
|
|
||||||
|
msgid "Allows to filter visits, returning only those older than start date"
|
||||||
|
msgstr "Permite filtrar las visitas, devolviendo sólo aquellas más antiguas que startDate"
|
||||||
|
|
||||||
|
msgid "Allows to filter visits, returning only those newer than end date"
|
||||||
|
msgstr "Permite filtrar las visitas, devolviendo sólo aquellas más nuevas que endDate"
|
||||||
|
|
||||||
|
msgid "A short code was not provided. Which short code do you want to use?:"
|
||||||
|
msgstr "No se prporcionó un código corto. ¿Qué código corto deseas usar?"
|
||||||
|
|
||||||
|
msgid "Referer"
|
||||||
|
msgstr "Origen"
|
||||||
|
|
||||||
|
msgid "Date"
|
||||||
|
msgstr "Fecha"
|
||||||
|
|
||||||
|
msgid "Remote Address"
|
||||||
|
msgstr "Dirección remota"
|
||||||
|
|
||||||
|
msgid "User agent"
|
||||||
|
msgstr "Agente de usuario"
|
||||||
|
@ -13,6 +13,7 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Question\Question;
|
use Symfony\Component\Console\Question\Question;
|
||||||
|
use Zend\I18n\Translator\TranslatorInterface;
|
||||||
|
|
||||||
class GetVisitsCommand extends Command
|
class GetVisitsCommand extends Command
|
||||||
{
|
{
|
||||||
@ -20,35 +21,47 @@ class GetVisitsCommand extends Command
|
|||||||
* @var VisitsTrackerInterface
|
* @var VisitsTrackerInterface
|
||||||
*/
|
*/
|
||||||
private $visitsTracker;
|
private $visitsTracker;
|
||||||
|
/**
|
||||||
|
* @var TranslatorInterface
|
||||||
|
*/
|
||||||
|
private $translator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GetVisitsCommand constructor.
|
* GetVisitsCommand constructor.
|
||||||
* @param VisitsTrackerInterface|VisitsTracker $visitsTracker
|
* @param VisitsTrackerInterface|VisitsTracker $visitsTracker
|
||||||
|
* @param TranslatorInterface $translator
|
||||||
*
|
*
|
||||||
* @Inject({VisitsTracker::class})
|
* @Inject({VisitsTracker::class, "translator"})
|
||||||
*/
|
*/
|
||||||
public function __construct(VisitsTrackerInterface $visitsTracker)
|
public function __construct(VisitsTrackerInterface $visitsTracker, TranslatorInterface $translator)
|
||||||
{
|
{
|
||||||
parent::__construct(null);
|
|
||||||
$this->visitsTracker = $visitsTracker;
|
$this->visitsTracker = $visitsTracker;
|
||||||
|
$this->translator = $translator;
|
||||||
|
parent::__construct(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configure()
|
public function configure()
|
||||||
{
|
{
|
||||||
$this->setName('shortcode:visits')
|
$this->setName('shortcode:visits')
|
||||||
->setDescription('Returns the detailed visits information for provided short code')
|
->setDescription(
|
||||||
->addArgument('shortCode', InputArgument::REQUIRED, 'The short code which visits we want to get')
|
$this->translator->translate('Returns the detailed visits information for provided short code')
|
||||||
|
)
|
||||||
|
->addArgument(
|
||||||
|
'shortCode',
|
||||||
|
InputArgument::REQUIRED,
|
||||||
|
$this->translator->translate('The short code which visits we want to get')
|
||||||
|
)
|
||||||
->addOption(
|
->addOption(
|
||||||
'startDate',
|
'startDate',
|
||||||
's',
|
's',
|
||||||
InputOption::VALUE_OPTIONAL,
|
InputOption::VALUE_OPTIONAL,
|
||||||
'Allows to filter visits, returning only those older than start date'
|
$this->translator->translate('Allows to filter visits, returning only those older than start date')
|
||||||
)
|
)
|
||||||
->addOption(
|
->addOption(
|
||||||
'endDate',
|
'endDate',
|
||||||
'e',
|
'e',
|
||||||
InputOption::VALUE_OPTIONAL,
|
InputOption::VALUE_OPTIONAL,
|
||||||
'Allows to filter visits, returning only those newer than end date'
|
$this->translator->translate('Allows to filter visits, returning only those newer than end date')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,9 +74,10 @@ class GetVisitsCommand extends Command
|
|||||||
|
|
||||||
/** @var QuestionHelper $helper */
|
/** @var QuestionHelper $helper */
|
||||||
$helper = $this->getHelper('question');
|
$helper = $this->getHelper('question');
|
||||||
$question = new Question(
|
$question = new Question(sprintf(
|
||||||
'<question>A short code was not provided. Which short code do you want to use?:</question> '
|
'<question>%s</question> ',
|
||||||
);
|
$this->translator->translate('A short code was not provided. Which short code do you want to use?:')
|
||||||
|
));
|
||||||
|
|
||||||
$shortCode = $helper->ask($input, $output, $question);
|
$shortCode = $helper->ask($input, $output, $question);
|
||||||
if (! empty($shortCode)) {
|
if (! empty($shortCode)) {
|
||||||
@ -80,10 +94,10 @@ class GetVisitsCommand extends Command
|
|||||||
$visits = $this->visitsTracker->info($shortCode, new DateRange($startDate, $endDate));
|
$visits = $this->visitsTracker->info($shortCode, new DateRange($startDate, $endDate));
|
||||||
$table = new Table($output);
|
$table = new Table($output);
|
||||||
$table->setHeaders([
|
$table->setHeaders([
|
||||||
'Referer',
|
$this->translator->translate('Referer'),
|
||||||
'Date',
|
$this->translator->translate('Date'),
|
||||||
'Remote Address',
|
$this->translator->translate('Remote Address'),
|
||||||
'User agent',
|
$this->translator->translate('User agent'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach ($visits as $row) {
|
foreach ($visits as $row) {
|
||||||
|
Loading…
Reference in New Issue
Block a user