forked from Snck3rs/contao-leaflet-maps
Use symfony translator.
This commit is contained in:
@@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Dca;
|
namespace Netzmacht\Contao\Leaflet\Dca;
|
||||||
|
|
||||||
use ContaoCommunityAlliance\Translator\TranslatorInterface as Translator;
|
|
||||||
use Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory;
|
use Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory;
|
||||||
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
||||||
use Netzmacht\Contao\Leaflet\Model\MapModel;
|
use Netzmacht\Contao\Leaflet\Model\MapModel;
|
||||||
|
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Module is the helper for the tl_module dca.
|
* Class Module is the helper for the tl_module dca.
|
||||||
@@ -88,18 +88,18 @@ class FrontendIntegration
|
|||||||
\RequestToken::get(),
|
\RequestToken::get(),
|
||||||
sprintf(
|
sprintf(
|
||||||
$pattern,
|
$pattern,
|
||||||
specialchars($this->translator->translate('editalias.1', 'tl_content', [$dataContainer->value])),
|
specialchars($this->translator->trans('editalias.1', [$dataContainer->value], 'contao_tl_content')),
|
||||||
specialchars(
|
specialchars(
|
||||||
str_replace(
|
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(
|
\Image::getHtml(
|
||||||
'alias.gif',
|
'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"'
|
'style="vertical-align:top"'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,11 +12,11 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Dca;
|
namespace Netzmacht\Contao\Leaflet\Dca;
|
||||||
|
|
||||||
use ContaoCommunityAlliance\Translator\TranslatorInterface as Translator;
|
|
||||||
use Netzmacht\Contao\Toolkit\Dca\Callback\Callbacks;
|
use Netzmacht\Contao\Toolkit\Dca\Callback\Callbacks;
|
||||||
use Netzmacht\Contao\Toolkit\Dca\Manager;
|
use Netzmacht\Contao\Toolkit\Dca\Manager;
|
||||||
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
||||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
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.
|
* Class Layer is the helper class for the tl_leaflet_layer dca.
|
||||||
@@ -203,10 +203,10 @@ class LayerCallbacks extends Callbacks
|
|||||||
$buffer = sprintf(
|
$buffer = sprintf(
|
||||||
'<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a> ',
|
'<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a> ',
|
||||||
$pasteAfterUrl,
|
$pasteAfterUrl,
|
||||||
specialchars($this->translator->translate('pasteafter.1', $table, [$row['id']])),
|
specialchars($this->translator->trans('pasteafter.1', [$row['id']], 'contao_' . $table)),
|
||||||
\Image::getHtml(
|
\Image::getHtml(
|
||||||
'pasteafter.gif',
|
'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(
|
$buffer .= sprintf(
|
||||||
'<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a> ',
|
'<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a> ',
|
||||||
$pasteIntoUrl,
|
$pasteIntoUrl,
|
||||||
specialchars($this->translator->translate('pasteinto.1', $table, [$row['id']])),
|
specialchars($this->translator->trans('pasteinto.1', [$row['id']], 'contao_' . $table)),
|
||||||
\Image::getHtml(
|
\Image::getHtml(
|
||||||
'pasteinto.gif',
|
'pasteinto.gif',
|
||||||
$this->translator->translate('pasteinto.1', $table, [$row['id']])
|
$this->translator->trans('pasteinto.1', [$row['id']], 'contao_' . $table)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} elseif ($row['id'] > 0) {
|
} elseif ($row['id'] > 0) {
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Dca;
|
namespace Netzmacht\Contao\Leaflet\Dca;
|
||||||
|
|
||||||
use ContaoCommunityAlliance\Translator\TranslatorInterface as Translator;
|
|
||||||
use Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory;
|
use Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory;
|
||||||
use Netzmacht\LeafletPHP\Value\LatLng;
|
use Netzmacht\LeafletPHP\Value\LatLng;
|
||||||
|
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Validator.
|
* Class Validator.
|
||||||
@@ -66,7 +66,7 @@ class Validator
|
|||||||
LatLng::fromString($value);
|
LatLng::fromString($value);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new \InvalidArgumentException(
|
throw new \InvalidArgumentException(
|
||||||
$this->translator->translate('invalidCoordinates', 'leaflet', [$value]),
|
$this->translator->trans('invalidCoordinates', [$value], 'contao_leaflet'),
|
||||||
0,
|
0,
|
||||||
$e
|
$e
|
||||||
);
|
);
|
||||||
@@ -126,7 +126,7 @@ class Validator
|
|||||||
{
|
{
|
||||||
if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]+$/', $value) !== 1) {
|
if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]+$/', $value) !== 1) {
|
||||||
throw new \InvalidArgumentException(
|
throw new \InvalidArgumentException(
|
||||||
$this->translator->translate('invalidAlias', 'leaflet')
|
$this->translator->trans('invalidAlias', [], 'contao_leaflet')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user