Skip to content

Commit

Permalink
translation test
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnyga committed Apr 21, 2017
1 parent 8068234 commit ba59418
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 9 deletions.
17 changes: 14 additions & 3 deletions LensGalleyPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ function articleCallback($hookName, $args) {
if ($galley && in_array($galley->getFileType(), array('application/xml', 'text/xml'))) {

$replaceImages = json_encode($this->_getReplaceImages($request, $galley), JSON_UNESCAPED_SLASHES);

$translationStrings = json_encode($this->_getTranslations(), JSON_UNESCAPED_SLASHES);

$templateMgr->assign(array(
'pluginLensPath' => $this->getLensPath($request),
'pluginTemplatePath' => $this->getTemplatePath(),
Expand All @@ -82,6 +83,7 @@ function articleCallback($hookName, $args) {
'galley' => $galley,
'jQueryUrl' => $this->_getJQueryUrl($request),
'replaceImages' => $replaceImages,
'translationStrings' => $translationStrings,
));
$templateMgr->display($this->getTemplatePath() . '/articleGalley.tpl');
return true;
Expand Down Expand Up @@ -192,8 +194,17 @@ function _getReplaceImages($request, $galley) {
}

return $replaceImages;
}

}

/**
* Return array containing the translation strings for lens
* @return Array
*/
function _getTranslations() {
return array(
'back' => __('plugins.generic.lensGalley.translate.back'),
);
}

}

Expand Down
2 changes: 1 addition & 1 deletion lib/lens/lens.js
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@
a.Prototype = function() {
this.render = function() {
r.prototype.render.call(this), this.content.appendChild(i(".back-button", {
html: '<a href="./">Back</a>'
html: '<a href="./">'+translate.back+'</a>'
}));
var t = this.node,
e = this.node.document.get("publication_info");
Expand Down
3 changes: 3 additions & 0 deletions locale/en_US/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
<locale name="en_US" full_name="U.S. English">
<message key="plugins.generic.lensGalley.displayName">eLife Lens Article Viewer</message>
<message key="plugins.generic.lensGalley.description">This plugin provides rendering support for JATS XML galleys using eLife Lens.</message>

<message key="plugins.generic.lensGalley.translate.back">Back</message>

</locale>
13 changes: 8 additions & 5 deletions locale/sr_RS@latin/locale.xml → locale/fi_FI/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
<!DOCTYPE locale SYSTEM "../../../../../lib/pkp/dtd/locale.dtd">

<!--
* plugins/generic/lensGalley/locale/sr_RS@latin/locale.xml
* plugins/generic/lensGalley/locale/fi_FI/locale.xml
*
* Copyright (c) 2014-2017 Simon Fraser University
* Copyright (c) 2003-2017 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
* Localization information: https://pkp.sfu.ca/wiki/index.php?title=OJS:_Serbian_(sr_RS)
*
* Localization strings.
-->

<locale name="sr_RS@latin" full_name="Srpski">
<message key="plugins.generic.lensGalley.displayName">eLife Lens Pregledač članaka</message>
<message key="plugins.generic.lensGalley.description">Ovaj dodatak omogućuje renderovanje za JATS XML fajlove članaka korišćenjem eLife Lens.</message>
<locale name="en_US" full_name="U.S. English">
<message key="plugins.generic.lensGalley.displayName">eLife Lens</message>
<message key="plugins.generic.lensGalley.description">Tämä lisäosa muuntaa JATS XML -muotoisen artikkelin HTML-muotoon käyttämällä eLife Lens -ohjelmistoa.</message>

<message key="plugins.generic.lensGalley.translate.back">Takaisin</message>

</locale>
17 changes: 17 additions & 0 deletions locale/sr_SR/locale.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE locale SYSTEM "../../../../../lib/pkp/dtd/locale.dtd">

<!--
* plugins/generic/lensGalley/locale/sr_SR/locale.xml
*
* Copyright (c) 2014-2017 Simon Fraser University
* Copyright (c) 2003-2017 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* Localization strings.
-->

<locale name="sr_SR" full_name="Српски">
<message key="plugins.generic.lensGalley.displayName">eLife Lens Article Viewer</message>
<message key="plugins.generic.lensGalley.description">Овај додатак омогућује рендеровање за JATS XML фајлове чланака коришћењем eLife Lens.</message>
</locale>
2 changes: 2 additions & 0 deletions templates/display.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
document.head.appendChild(linkElement);

replace_images = {/literal}{$replaceImages}{literal};
translate = {/literal}{$translationStrings}{literal};


$(document).ready(function(){
var app = new Lens({
Expand Down

0 comments on commit ba59418

Please sign in to comment.