From 977ff01ced2a915dd57322bd2c530372f2ca096d Mon Sep 17 00:00:00 2001 From: David Molineus Date: Thu, 8 Jan 2015 12:27:08 +0100 Subject: [PATCH] Add translations. --- module/dca/tl_leaflet_control.php | 6 +- module/dca/tl_leaflet_layer.php | 3 + module/dca/tl_leaflet_marker.php | 15 +++-- module/dca/tl_leaflet_vector.php | 48 +++++++-------- module/languages/en/leaflet.php | 36 +++++++++++ module/languages/en/leaflet_layer.php | 8 --- module/languages/en/tl_leaflet_icon.php | 19 ++++++ module/languages/en/tl_leaflet_marker.php | 48 +++++++++++++++ module/languages/en/tl_leaflet_vector.php | 70 ++++++++++++++++++++++ src/Netzmacht/Contao/Leaflet/Dca/Layer.php | 6 +- 10 files changed, 212 insertions(+), 47 deletions(-) create mode 100644 module/languages/en/leaflet.php delete mode 100644 module/languages/en/leaflet_layer.php create mode 100644 module/languages/en/tl_leaflet_marker.php create mode 100644 module/languages/en/tl_leaflet_vector.php diff --git a/module/dca/tl_leaflet_control.php b/module/dca/tl_leaflet_control.php index 166748f..df64eee 100644 --- a/module/dca/tl_leaflet_control.php +++ b/module/dca/tl_leaflet_control.php @@ -1,5 +1,7 @@ array( @@ -157,8 +159,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array 'includeBlankOption' => true, 'submitOnChange' => true, 'chosen' => true, + 'helpwizard' => true, ), 'options' => $GLOBALS['LEAFLET_CONTROLS'], + 'reference' => &$GLOBALS['TL_LANG']['leaflet_control'], 'sql' => "varchar(32) NOT NULL default ''" ), 'position' => array @@ -323,7 +327,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['separate'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => array('tl_class' => 'w50'), + 'eval' => array('tl_class' => 'w50 m12'), 'sql' => "char(1) NOT NULL default ''" ), 'zoomControl' => array diff --git a/module/dca/tl_leaflet_layer.php b/module/dca/tl_leaflet_layer.php index 9bf5cec..99b60a0 100644 --- a/module/dca/tl_leaflet_layer.php +++ b/module/dca/tl_leaflet_layer.php @@ -1,5 +1,7 @@ array( @@ -189,6 +191,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array 'includeBlankOption' => true, 'submitOnChange' => true, 'chosen' => true, + 'helpwizard' => true, ), 'options' => array_keys($GLOBALS['LEAFLET_LAYERS']), 'reference' => &$GLOBALS['TL_LANG']['leaflet_layer'], diff --git a/module/dca/tl_leaflet_marker.php b/module/dca/tl_leaflet_marker.php index a446fc2..fbf83e3 100644 --- a/module/dca/tl_leaflet_marker.php +++ b/module/dca/tl_leaflet_marker.php @@ -1,5 +1,8 @@ array( @@ -12,7 +15,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array ( 'id' => 'primary' ) - ) + ), ), 'list' => array @@ -202,7 +205,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array ), 'icon' => array ( - 'label' => &$GLOBALS['TL_LANG']['tl_content']['icon'], + 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['icon'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Marker', 'getIcons'), @@ -218,7 +221,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['draggable'], 'exclude' => true, 'inputType' => 'checkbox', - 'default' => true, + 'default' => false, 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''" ), @@ -242,12 +245,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array ), 'zIndexOffset' => array ( - 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['zIndexOffset'], + 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['zIndexOffset'], 'exclude' => true, 'inputType' => 'text', 'default' => 0, - 'eval' => array('mandatory' => true, 'maxlength' => 4, 'rgxp' => 'digit', 'tl_class' => 'clr w50'), - 'sql' => "int(4) NOT NULL default '0'" + 'eval' => array('maxlength' => 5, 'rgxp' => 'digit', 'tl_class' => 'clr w50', 'nullIfEmpty' => true), + 'sql' => "int(5) NULL" ), ), ); diff --git a/module/dca/tl_leaflet_vector.php b/module/dca/tl_leaflet_vector.php index d5a49c6..4aba4db 100644 --- a/module/dca/tl_leaflet_vector.php +++ b/module/dca/tl_leaflet_vector.php @@ -1,5 +1,7 @@ array( @@ -54,6 +56,13 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array 'href' => 'act=copy', 'icon' => 'copy.gif' ), + 'cut' => array + ( + 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['cut'], + 'href' => 'act=paste&mode=cut', + 'icon' => 'cut.gif', + 'attributes' => 'onclick="Backend.getScrollOffset()"', + ), 'delete' => array ( 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['delete'], @@ -61,13 +70,6 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array 'icon' => 'delete.gif', 'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"' ), - 'cut' => array - ( - 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['cut'], - 'href' => 'act=paste&mode=cut', - 'icon' => 'cut.gif', - 'attributes' => 'onclick="Backend.getScrollOffset()"', - ), 'toggle' => array ( 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['toggle'], @@ -95,17 +97,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array 'default' => array( 'title' => array('title', 'alias', 'type'), 'data' => array(), - 'style' => array( - ':hide', - 'stroke', - 'color', - 'weight', - 'opacity', - 'dashArray', - 'fill', - 'lineCap', - 'lineJoin', - ), + 'style' => array(':hide', 'stroke', 'fill'), 'popup' => array(':hide','addPopup'), 'config' => array(':hide', 'clickable', 'className'), 'active' => array('active') @@ -136,7 +128,8 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array 'circleMarker extends circle' => array(), ), 'metasubpalettes' => array( - 'addPopup' => array('popupContent'), + 'addPopup' => array('popupContent'), + 'stroke' => array('color', 'weight', 'opacity', 'dashArray', 'lineCap', 'lineJoin'), 'fill' => array('fillColor', 'fillOpacity',) ), @@ -176,7 +169,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array ), 'type' => array ( - 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['type'], + 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['type'], 'exclude' => true, 'inputType' => 'select', 'eval' => array( @@ -185,9 +178,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array 'includeBlankOption' => true, 'submitOnChange' => true, 'chosen' => true, + 'helpwizard' => true, ), 'options' => &$GLOBALS['LEAFLET_VECTORS'], - 'reference' => &$GLOBALS['TL_LANG']['leaflet_layer'], + 'reference' => &$GLOBALS['TL_LANG']['leaflet_vector'], 'sql' => "varchar(32) NOT NULL default ''" ), 'active' => array @@ -221,7 +215,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array 'exclude' => true, 'inputType' => 'checkbox', 'default' => true, - 'eval' => array('tl_class' => 'w50 m12'), + 'eval' => array('tl_class' => 'w50', 'submitOnChange' => true), 'sql' => "char(1) NOT NULL default '1'" ), 'color' => array @@ -233,7 +227,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array \Netzmacht\Contao\DevTools\Dca::createColorPickerCallback(), ), 'eval' => array( - 'tl_class' => 'w50 wizard', + 'tl_class' => 'w50 wizard clr', 'maxlength' => 7, 'decodeEntities' => true ), @@ -245,7 +239,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array 'exclude' => true, 'inputType' => 'text', 'default' => 5, - 'eval' => array('mandatory' => false, 'maxlength' => 4, 'rgxp' => 'digit', 'tl_class' => 'clr w50'), + 'eval' => array('mandatory' => false, 'maxlength' => 4, 'rgxp' => 'digit', 'tl_class' => 'w50'), 'sql' => "int(4) NOT NULL default '5'" ), 'opacity' => array @@ -262,7 +256,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['fill'], 'exclude' => true, 'inputType' => 'checkbox', - 'eval' => array('tl_class' => 'w50 m12', 'submitOnChange' => true), + 'eval' => array('tl_class' => 'clr w50', 'submitOnChange' => true), 'sql' => "char(1) NOT NULL default ''" ), 'fillColor' => array @@ -282,7 +276,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array ), 'fillOpacity' => array ( - 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['weight'], + 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['fillOpacity'], 'exclude' => true, 'inputType' => 'text', 'default' => '0.2', @@ -294,7 +288,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['dashArray'], 'exclude' => true, 'inputType' => 'text', - 'eval' => array('mandatory' => false, 'maxlength' => 32, 'tl_class' => 'w50 clr'), + 'eval' => array('mandatory' => false, 'maxlength' => 32, 'tl_class' => 'w50'), 'sql' => "varchar(32) NOT NULL default ''" ), 'lineCap' => array diff --git a/module/languages/en/leaflet.php b/module/languages/en/leaflet.php new file mode 100644 index 0000000..399defd --- /dev/null +++ b/module/languages/en/leaflet.php @@ -0,0 +1,36 @@ +Leaflet documentation.'; +$GLOBALS['TL_LANG']['leaflet_control']['attribution'][0] = 'Attribution control'; +$GLOBALS['TL_LANG']['leaflet_control']['attribution'][1] = 'The attribution control allows you to display attribution data in a small text box on a map. For more details read the Leaflet documentation.'; +$GLOBALS['TL_LANG']['leaflet_control']['layers'][0] = 'Layers control'; +$GLOBALS['TL_LANG']['leaflet_control']['layers'][1] = 'The layers control gives users the ability to switch between different base layers and switch overlays on/off. For more details read the Leaflet documentation.'; +$GLOBALS['TL_LANG']['leaflet_control']['scale'][0] = 'Scale control'; +$GLOBALS['TL_LANG']['leaflet_control']['scale'][1] = 'A simple scale control that shows the scale of the current center of the screen. For more details read the Leaflet documentation.'; +$GLOBALS['TL_LANG']['leaflet_control']['loading'][0] = 'Loading indicator'; +$GLOBALS['TL_LANG']['leaflet_control']['loading'][1] = 'Leaflet.loading is a simple loading indicator implemented as control. For more details read the Plugin documentation.'; + +$GLOBALS['TL_LANG']['leaflet_layer']['provider'][0] = 'Leaflet provider'; +$GLOBALS['TL_LANG']['leaflet_layer']['provider'][1] = 'Leaflet tile provider. For more details read the plugin documentation.'; +$GLOBALS['TL_LANG']['leaflet_layer']['group'][0] = 'Layer group'; +$GLOBALS['TL_LANG']['leaflet_layer']['group'][1] = 'Layer groups combines different layers. For more details read the Leaflet documentation. '; +$GLOBALS['TL_LANG']['leaflet_layer']['markers'][0] = 'Markers'; +$GLOBALS['TL_LANG']['leaflet_layer']['markers'][1] = 'Layer containing Markers.'; +$GLOBALS['TL_LANG']['leaflet_layer']['vectors'][0] = 'Vectors'; +$GLOBALS['TL_LANG']['leaflet_layer']['vectors'][1] = 'Vectors layer containing vectors like polygons, polylines, etc.'; + +$GLOBALS['TL_LANG']['leaflet_vector']['polyline'][0] = 'Polyline'; +$GLOBALS['TL_LANG']['leaflet_vector']['polyline'][1] = 'Polyline overlay. For more details read the Leaflet documentation.'; +$GLOBALS['TL_LANG']['leaflet_vector']['multiPolyline'][0] = 'Multi polylines'; +$GLOBALS['TL_LANG']['leaflet_vector']['multiPolyline'][1] = 'Multi polylines with shared styling. For more details read the Leaflet documentation.'; +$GLOBALS['TL_LANG']['leaflet_vector']['polygon'][0] = 'Polygon'; +$GLOBALS['TL_LANG']['leaflet_vector']['polygon'][1] = 'Polygon overlay. For more details read the Leaflet documentation.'; +$GLOBALS['TL_LANG']['leaflet_vector']['multiPolygon'][0] = 'Multi polygons'; +$GLOBALS['TL_LANG']['leaflet_vector']['multiPolygon'][1] = 'Multi polygons with shared styling. For more details read the Leaflet documentation.'; +$GLOBALS['TL_LANG']['leaflet_vector']['circle'][0] = 'Circle'; +$GLOBALS['TL_LANG']['leaflet_vector']['circle'][1] = 'Circle overlay. For more details read the Leaflet documentation.'; +$GLOBALS['TL_LANG']['leaflet_vector']['circleMarker'][0] = 'Circle marker'; +$GLOBALS['TL_LANG']['leaflet_vector']['circleMarker'][1] = 'Circle marker with fixed pixel width. For more details read the Leaflet documentation.'; +$GLOBALS['TL_LANG']['leaflet_vector']['rectangle'][0] = 'Rectangle'; +$GLOBALS['TL_LANG']['leaflet_vector']['rectangle'][1] = 'Rectangle overlay. For more details read the Leaflet documentation.'; diff --git a/module/languages/en/leaflet_layer.php b/module/languages/en/leaflet_layer.php deleted file mode 100644 index 196938c..0000000 --- a/module/languages/en/leaflet_layer.php +++ /dev/null @@ -1,8 +0,0 @@ -dash pattern.'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['fill'][0] = 'Fill vector'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['fill'][1] = 'Whether to fill the path with color.'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['fillColor'][0] = 'Fill color'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['fillColor'][1] = 'Custom stroke color. Leaf empty to use default. Value is a ful hex value (with #).'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['fillOpacity'][0] = 'Fill opacity'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['fillOpacity'][1] = 'Fill opacity as a value between 0 and 1.'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['lineCap'][0] = 'Stroke line cap'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['lineCap'][1] = 'A string that defines shape to be used at the end of the stroke.'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['lineJoin'][0] = 'Stroke line join'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['lineJoin'][1] = 'A string that defines shape to be used at the corners of the stroke.'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['addPopup'][0] = 'Add popup'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['addPopup'][1] = 'Add a popup to the vector.'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['popupContent'][0] = 'Popup content'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['popupContent'][1] = 'Content of the popup. Insert tags are replaced.'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['clickable'][0] = 'Clickable'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['clickable'][1] = 'If deactivated, the vector will not emit mouse events and will act as a part of the underlying map.'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['active'][0] = 'Activate vector'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['active'][1] = 'Only activated vector are rendered on the map.'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['className'][0] = 'Class name'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['className'][1] = 'Custom class name set on an element.'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['coordinates'][0] = 'Coordinates'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['coordinates'][1] = 'Coordinates of the vector as comma separated value (Latitude, longitude [, altitude]).'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['radius'][0] = 'Radius'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['radius'][1] = 'Radius of the element. For a circle its defined in meters, for a circle marker in pixels.'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['bounds'][0] = 'Bounds'; +$GLOBALS['TL_LANG']['tl_leaflet_vector']['bounds'][1] = 'Each field defines a corner of the bounds as comma separated value (Latitude, longitude [, altitude]).'; diff --git a/src/Netzmacht/Contao/Leaflet/Dca/Layer.php b/src/Netzmacht/Contao/Leaflet/Dca/Layer.php index 4feda5a..95de5b6 100644 --- a/src/Netzmacht/Contao/Leaflet/Dca/Layer.php +++ b/src/Netzmacht/Contao/Leaflet/Dca/Layer.php @@ -44,10 +44,6 @@ class Layer ? $row['type'] : $GLOBALS['TL_LANG']['leaflet_layer'][$row['type']][0]; - $title = empty($GLOBALS['TL_LANG']['leaflet_layer'][$row['type']][1]) - ? $row['type'] - : $GLOBALS['TL_LANG']['leaflet_layer'][$row['type']][1]; - if (!empty($this->layers[$row['type']]['icon'])) { $src = $this->layers[$row['type']]['icon']; @@ -59,7 +55,7 @@ class Layer $src = preg_replace('/(\.[^\.]+)$/', '_1$1', $src); } - $icon = \Image::getHtml($src, $alt, sprintf('title="%s"', $title)); + $icon = \Image::getHtml($src, $alt, sprintf('title="%s"', strip_tags($alt))); return $icon . ' ' . $label; }