Use symfony translator.

This commit is contained in:
David Molineus
2017-10-05 16:40:13 +02:00
parent bce7e31cb3
commit 04c693ac7f
3 changed files with 12 additions and 12 deletions

View File

@@ -12,10 +12,10 @@
namespace Netzmacht\Contao\Leaflet\Dca;
use ContaoCommunityAlliance\Translator\TranslatorInterface as Translator;
use Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
use Netzmacht\Contao\Leaflet\Model\MapModel;
use Symfony\Component\Translation\TranslatorInterface as Translator;
/**
* Class Module is the helper for the tl_module dca.
@@ -88,18 +88,18 @@ class FrontendIntegration
\RequestToken::get(),
sprintf(
$pattern,
specialchars($this->translator->translate('editalias.1', 'tl_content', [$dataContainer->value])),
specialchars($this->translator->trans('editalias.1', [$dataContainer->value], 'contao_tl_content')),
specialchars(
str_replace(
"'",
"\\'",
sprintf($this->translator->translate('editalias.1', 'tl_content', [$dataContainer->value]))
sprintf($this->translator->trans('editalias.1', [$dataContainer->value], 'contao_tl_content'))
)
)
),
\Image::getHtml(
'alias.gif',
$this->translator->translate('editalias.0', 'tl_content', [$dataContainer->value]),
$this->translator->trans('editalias.0', [$dataContainer->value], 'contao_tl_content'),
'style="vertical-align:top"'
)
);

View File

@@ -12,11 +12,11 @@
namespace Netzmacht\Contao\Leaflet\Dca;
use ContaoCommunityAlliance\Translator\TranslatorInterface as Translator;
use Netzmacht\Contao\Toolkit\Dca\Callback\Callbacks;
use Netzmacht\Contao\Toolkit\Dca\Manager;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Symfony\Component\Translation\TranslatorInterface as Translator;
/**
* Class Layer is the helper class for the tl_leaflet_layer dca.
@@ -203,10 +203,10 @@ class LayerCallbacks extends Callbacks
$buffer = sprintf(
'<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a> ',
$pasteAfterUrl,
specialchars($this->translator->translate('pasteafter.1', $table, [$row['id']])),
specialchars($this->translator->trans('pasteafter.1', [$row['id']], 'contao_' . $table)),
\Image::getHtml(
'pasteafter.gif',
$this->translator->translate('pasteafter.1', $table, [$row['id']])
$this->translator->trans('pasteafter.1', [$row['id']], 'contao_' . $table)
)
);
@@ -223,10 +223,10 @@ class LayerCallbacks extends Callbacks
$buffer .= sprintf(
'<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a> ',
$pasteIntoUrl,
specialchars($this->translator->translate('pasteinto.1', $table, [$row['id']])),
specialchars($this->translator->trans('pasteinto.1', [$row['id']], 'contao_' . $table)),
\Image::getHtml(
'pasteinto.gif',
$this->translator->translate('pasteinto.1', $table, [$row['id']])
$this->translator->trans('pasteinto.1', [$row['id']], 'contao_' . $table)
)
);
} elseif ($row['id'] > 0) {

View File

@@ -12,9 +12,9 @@
namespace Netzmacht\Contao\Leaflet\Dca;
use ContaoCommunityAlliance\Translator\TranslatorInterface as Translator;
use Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory;
use Netzmacht\LeafletPHP\Value\LatLng;
use Symfony\Component\Translation\TranslatorInterface as Translator;
/**
* Class Validator.
@@ -66,7 +66,7 @@ class Validator
LatLng::fromString($value);
} catch (\Exception $e) {
throw new \InvalidArgumentException(
$this->translator->translate('invalidCoordinates', 'leaflet', [$value]),
$this->translator->trans('invalidCoordinates', [$value], 'contao_leaflet'),
0,
$e
);
@@ -126,7 +126,7 @@ class Validator
{
if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]+$/', $value) !== 1) {
throw new \InvalidArgumentException(
$this->translator->translate('invalidAlias', 'leaflet')
$this->translator->trans('invalidAlias', [], 'contao_leaflet')
);
}