Use language dictionary from typo3 backend in frontend code
This commit is contained in:
parent
5e592f6425
commit
0940f3467c
|
@ -148,8 +148,7 @@ class tx_dlf_pageview extends tx_dlf_plugin {
|
|||
controls: ["' . implode('", "', $this->controls) . '"],
|
||||
div: "' . $this->conf['elementId'] . '",
|
||||
fulltexts: ["' . implode('", "', $this->fulltexts) . '"],
|
||||
images: ["' . implode('", "', $this->images) . '"],
|
||||
lang: "'.$this->lang.'"
|
||||
images: ["' . implode('", "', $this->images) . '"]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,13 +90,6 @@ var dlfViewer = function(settings){
|
|||
*/
|
||||
this.offset = 0;
|
||||
|
||||
/**
|
||||
* Language token
|
||||
* @type {string}
|
||||
* @private
|
||||
*/
|
||||
this.lang = dlfUtils.exists(settings.lang) ? settings.lang : 'de';
|
||||
|
||||
/**
|
||||
* @type {Array.<number>}
|
||||
* @private
|
||||
|
@ -131,7 +124,7 @@ dlfViewer.prototype.addCustomControls = function() {
|
|||
// Adds fulltext behavior only if there are fulltext availabe and no double page
|
||||
// behavior is active
|
||||
if (this.fulltexts[0] !== undefined && this.fulltexts[0] !== '' && this.images.length == 1)
|
||||
fulltextControl = new dlfViewerFullTextControl(this.map, this.images[0], this.fulltexts[0], this.lang);
|
||||
fulltextControl = new dlfViewerFullTextControl(this.map, this.images[0], this.fulltexts[0]);
|
||||
|
||||
// add image manipulation tool if container is added
|
||||
if ($('.tx-dlf-tools-imagetools').length > 0 && dlfUtils.isWebGLEnabled()){
|
||||
|
|
|
@ -42,9 +42,8 @@ jQuery.fn.scrollTo = function(elem, speed) {
|
|||
* @param {ol.Map} map
|
||||
* @param {Object} image
|
||||
* @param {string} fulltextUrl
|
||||
* @param {string} lang
|
||||
*/
|
||||
var dlfViewerFullTextControl = function(map, image, fulltextUrl, lang){
|
||||
var dlfViewerFullTextControl = function(map, image, fulltextUrl){
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
@ -65,10 +64,12 @@ var dlfViewerFullTextControl = function(map, image, fulltextUrl, lang){
|
|||
this.url = fulltextUrl;
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
* @private
|
||||
* @type {string}
|
||||
*/
|
||||
this.lang = lang == 'de' || lang == 'en' ? lang : 'de';
|
||||
this.dic = $('#tx-dlf-tools-fulltext').length > 0 && $('#tx-dlf-tools-fulltext').attr('data-dic') ?
|
||||
dlfUtils.parseDataDic($('#tx-dlf-tools-fulltext')) :
|
||||
{'fulltext-on':'Activate Fulltext','fulltext-off':'Dectivate Fulltext'};
|
||||
|
||||
/**
|
||||
* @type {Array.<Array.<ol.Feature>}
|
||||
|
@ -274,11 +275,17 @@ var dlfViewerFullTextControl = function(map, image, fulltextUrl, lang){
|
|||
anchorEl.on('touchstart', toogleFulltext);
|
||||
};
|
||||
|
||||
// set initial title of fulltext element
|
||||
$("#tx-dlf-tools-fulltext")
|
||||
.text(this.dic['fulltext-on'])
|
||||
.attr('title', this.dic['fulltext-on']);
|
||||
|
||||
// if fulltext is activated via cookie than run activation methode
|
||||
if (dlfUtils.getCookie("tx-dlf-pageview-fulltext-select") == 'enabled') {
|
||||
// activate the fulltext behavior
|
||||
this.activate(anchorEl);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -355,11 +362,10 @@ dlfViewerFullTextControl.prototype.enableFulltextSelect = function(textBlockFeat
|
|||
this.map.addLayer(this.highlightLayerTextLine);
|
||||
|
||||
// show fulltext container
|
||||
var title = dlfViewerFullTextControl.dic[this.lang][1],
|
||||
className = 'fulltext-visible';
|
||||
var className = 'fulltext-visible';
|
||||
$("#tx-dlf-tools-fulltext").addClass(className)
|
||||
.text(title)
|
||||
.attr('title', title);
|
||||
.text(this.dic['fulltext-off'])
|
||||
.attr('title', this.dic['fulltext-off']);
|
||||
|
||||
$('#tx-dlf-fulltextselection').addClass(className);
|
||||
$('#tx-dlf-fulltextselection').show();
|
||||
|
@ -390,11 +396,10 @@ dlfViewerFullTextControl.prototype.disableFulltextSelect = function() {
|
|||
this.highlightLayer.getSource().clear();
|
||||
this.highlightLayerTextLine.getSource().clear()
|
||||
|
||||
var title = dlfViewerFullTextControl.dic[this.lang][0],
|
||||
className = 'fulltext-visible';
|
||||
var className = 'fulltext-visible';
|
||||
$("#tx-dlf-tools-fulltext").removeClass(className)
|
||||
.text(title)
|
||||
.attr('title', title);
|
||||
.text(this.dic['fulltext-on'])
|
||||
.attr('title', this.dic['fulltext-on']);
|
||||
|
||||
$('#tx-dlf-fulltextselection').removeClass(className);
|
||||
$('#tx-dlf-fulltextselection').hide();
|
||||
|
@ -546,12 +551,3 @@ dlfViewerFullTextControl.style.textlineStyle = function() {
|
|||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {{en: string[], de: string[]}}
|
||||
*/
|
||||
dlfViewerFullTextControl.dic = {
|
||||
'en': ['Activate Fulltext', 'Deactivate Fulltext'],
|
||||
'de': ['Volltexte an', 'Volltexte aus']
|
||||
};
|
|
@ -158,6 +158,24 @@ dlfUtils.isWebGLEnabled = function(){
|
|||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Element} element
|
||||
* @return {Object}
|
||||
*/
|
||||
dlfUtils.parseDataDic = function(element) {
|
||||
var dataDicString = $(element).attr('data-dic'),
|
||||
dataDicRecords = dataDicString.split(';'),
|
||||
dataDic = {};
|
||||
|
||||
for (var i = 0, ii = dataDicRecords.length; i < ii; i++){
|
||||
var key = dataDicRecords[i].split(':')[0],
|
||||
value = dataDicRecords[i].split(':')[1];
|
||||
dataDic[key] = value;
|
||||
}
|
||||
|
||||
return dataDic;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set a cookie value
|
||||
*
|
||||
|
|
|
@ -93,9 +93,11 @@ class tx_dlf_toolsFulltext extends tx_dlf_plugin {
|
|||
$fullTextFile = $this->doc->physicalPagesInfo[$this->doc->physicalPages[$this->piVars['page']]]['files'][$this->conf['fileGrpFulltext']];
|
||||
|
||||
if (!empty($fullTextFile)) {
|
||||
$markerArray['###FULLTEXT_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-fulltext" title="'.$this->pi_getLL('fulltext-select', '', TRUE).'">'.$this->pi_getLL('fulltext-select', '', TRUE).'</a>';
|
||||
$markerArray['###FULLTEXT_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-fulltext" title="" data-dic="fulltext-on:'
|
||||
.$this->pi_getLL('fulltext-on', '', TRUE).';fulltext-off:'
|
||||
.$this->pi_getLL('fulltext-off', '', TRUE).'"></a>';
|
||||
} else {
|
||||
$markerArray['###FULLTEXT_SELECT###'] = $this->pi_getLL('fulltext-select', '', TRUE);
|
||||
$markerArray['###FULLTEXT_SELECT###'] = $this->pi_getLL('fulltext-not-available', '', TRUE);
|
||||
}
|
||||
|
||||
$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
|
||||
|
|
|
@ -28,10 +28,14 @@
|
|||
</meta>
|
||||
<data type="array">
|
||||
<languageKey index="default" type="array">
|
||||
<label index="fulltext-select">Activate Fulltext</label>
|
||||
<label index="fulltext-on">Activate Fulltext</label>
|
||||
<label index="fulltext-off">Dectivate Fulltext</label>
|
||||
<label index="fulltext-not-available">No Fulltext available</label>
|
||||
</languageKey>
|
||||
<languageKey index="de" type="array">
|
||||
<label index="fulltext-select">Volltexte an</label>
|
||||
<label index="fulltext-on">Volltext an</label>
|
||||
<label index="fulltext-off">Volltext aus</label>
|
||||
<label index="fulltext-not-available">Keine Volltexte vorhanden</label>
|
||||
</languageKey>
|
||||
</data>
|
||||
</T3locallang>
|
||||
|
|
Loading…
Reference in New Issue