diff --git a/languages/en.ini b/languages/en.ini index 92f69cd1b97a243be4d1661545c5270ee3ad1730..92d4692b660bcb5d24ebb7669d134342120f85bd 100644 --- a/languages/en.ini +++ b/languages/en.ini @@ -59,6 +59,7 @@ alphabrowselink_html = "Browse entries by %%index%% starting from <a href="%%url An error has occurred = "An error has occurred" An error occurred during execution; please try again later. = "An error occurred during execution; please try again later." AND = "AND" +and = "and" anonymous_tags = "Anonymous Tags" APA Citation = "APA Citation" applied_filter = "Applied Filter" diff --git a/languages/fi.ini b/languages/fi.ini index 6c7afcc2c3ba2a81ae38a92cb379e9338c5f226b..08cd48f82f76bf718fb1b3a8e45c4a500dd92589 100644 --- a/languages/fi.ini +++ b/languages/fi.ini @@ -58,6 +58,7 @@ alphabrowselink_html = "Selaa %%index%%-indeksiä alkaen kohdasta <a href="%%url An error has occurred = "Tapahtui virhe" An error occurred during execution; please try again later. = "Virhe toimintoa suoritettaessa. Yritä myöhemmin uudelleen." AND = "JA" +and = "ja" anonymous_tags = "Tuntemattomien tagit" APA Citation = "APA-viite" applied_filter = "Käytetty suodatus" diff --git a/languages/sv.ini b/languages/sv.ini index 885236d1a8efa01069c9cca87a08fc355db07e59..8ca9d4a5218127c06b1f5ed39f329d19a1e39c90 100644 --- a/languages/sv.ini +++ b/languages/sv.ini @@ -58,6 +58,7 @@ alphabrowselink_html = "Bläddra efter %%index%% från <a href="%%url%%">%%from% An error has occurred = "Det har uppstått ett fel" An error occurred during execution; please try again later. = "Utförandet misslyckades. Försök på nytt efter en stund." AND = "OCH" +and = "och" anonymous_tags = "Anonyma taggar" APA Citation = "APA-referens" applied_filter = "Filter i bruk" diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Citation.php b/module/VuFind/src/VuFind/View/Helper/Root/Citation.php index dff3e52860b1077d7df7608ec9f4bd1a670a5c71..a8fb868655af3107a04f61ac4c967e5d9c263066 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Citation.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Citation.php @@ -22,12 +22,14 @@ * @category VuFind * @package View_Helpers * @author Demian Katz <demian.katz@villanova.edu> + * @author Juha Luoma <juha.luoma@helsinki.fi> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link https://vufind.org/wiki/development Wiki */ namespace VuFind\View\Helper\Root; use VuFind\Date\DateException; +use VuFind\I18n\Translator\TranslatorAwareInterface; /** * Citation view helper @@ -35,11 +37,15 @@ use VuFind\Date\DateException; * @category VuFind * @package View_Helpers * @author Demian Katz <demian.katz@villanova.edu> + * @author Juha Luoma <juha.luoma@helsinki.fi> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link https://vufind.org/wiki/development Wiki */ class Citation extends \Zend\View\Helper\AbstractHelper + implements TranslatorAwareInterface { + use \VuFind\I18n\Translator\TranslatorAwareTrait; + /** * Citation details * @@ -82,16 +88,12 @@ class Citation extends \Zend\View\Helper\AbstractHelper public function __invoke($driver) { // Build author list: - $authors = []; - $primary = $driver->tryMethod('getPrimaryAuthor'); - if (empty($primary)) { - $primary = $driver->tryMethod('getCorporateAuthor'); - } - if (!empty($primary)) { - $authors[] = $primary; + $authors = (array)$driver->tryMethod('getPrimaryAuthors'); + if (empty($authors)) { + $authors = (array)$driver->tryMethod('getCorporateAuthors'); } - $secondary = $driver->tryMethod('getSecondaryAuthors'); - if (is_array($secondary) && !empty($secondary)) { + $secondary = (array)$driver->tryMethod('getSecondaryAuthors'); + if (!empty($secondary)) { $authors = array_unique(array_merge($authors, $secondary)); } @@ -702,12 +704,12 @@ class Citation extends \Zend\View\Helper\AbstractHelper $i = 0; if (count($this->details['authors']) > $etAlThreshold) { $author = $this->details['authors'][0]; - $authorStr = $this->cleanNameDates($author) . ', et al'; + $authorStr = $this->cleanNameDates($author) . ', et al.'; } else { foreach ($this->details['authors'] as $author) { if (($i + 1 == count($this->details['authors'])) && ($i > 0)) { // Last - $authorStr .= ', and ' . + $authorStr .= ', ' . $this->translate('and') . ' ' . $this->reverseName($this->stripPunctuation($author)); } elseif ($i > 0) { $authorStr .= ', ' .