diff --git a/module/VuFind/src/VuFind/Controller/AjaxController.php b/module/VuFind/src/VuFind/Controller/AjaxController.php index 5d415ded688ac13acaed697e0c696e69c649c1e0..987dd22ed2a5bb261b4e40738fec38f41536309e 100644 --- a/module/VuFind/src/VuFind/Controller/AjaxController.php +++ b/module/VuFind/src/VuFind/Controller/AjaxController.php @@ -277,13 +277,15 @@ class AjaxController extends AbstractBase * Support method for getItemStatuses() -- when presented with multiple values, * pick which one(s) to send back via AJAX. * - * @param array $list Array of values to choose from. - * @param string $mode config.ini setting -- first, all or msg - * @param string $msg Message to display if $mode == "msg" + * @param array $list Array of values to choose from. + * @param string $mode config.ini setting -- first, all or msg + * @param string $msg Message to display if $mode == "msg" + * @param string $transPrefix Translator prefix to apply to values (false to + * omit translation of values) * * @return string */ - protected function pickValue($list, $mode, $msg) + protected function pickValue($list, $mode, $msg, $transPrefix = false) { // Make sure array contains only unique values: $list = array_unique($list); @@ -291,11 +293,25 @@ class AjaxController extends AbstractBase // If there is only one value in the list, or if we're in "first" mode, // send back the first list value: if ($mode == 'first' || count($list) == 1) { - return $list[0]; + if (!$transPrefix) { + return $list[0]; + } else { + return $this->translate($transPrefix . $list[0], array(), $list[0]); + } } else if (count($list) == 0) { // Empty list? Return a blank string: return ''; } else if ($mode == 'all') { + // Translate values if necessary: + if ($transPrefix) { + $transList = array(); + foreach ($list as $current) { + $transList[] = $this->translate( + $transPrefix . $current, array(), $current + ); + } + $list = $transList; + } // All values mode? Return comma-separated values: return implode(', ', $list); } else { @@ -349,7 +365,7 @@ class AjaxController extends AbstractBase // Determine location string based on findings: $location = $this->pickValue( - $locations, $locationSetting, 'Multiple Locations' + $locations, $locationSetting, 'Multiple Locations', 'location_' ); $availability_message = $use_unknown_status @@ -416,7 +432,10 @@ class AjaxController extends AbstractBase $locationInfo = array( 'availability' => isset($details['available']) ? $details['available'] : false, - 'location' => htmlentities($location, ENT_COMPAT, 'UTF-8'), + 'location' => htmlentities( + $this->translate('location_' . $location, array(), $location), + ENT_COMPAT, 'UTF-8' + ), 'callnumbers' => htmlentities($locationCallnumbers, ENT_COMPAT, 'UTF-8') ); diff --git a/themes/blueprint/templates/RecordTab/holdingsils.phtml b/themes/blueprint/templates/RecordTab/holdingsils.phtml index f8f5a2272904a0a3ecfc70a167d2ec1c1bc9b1c3..8b6ab43d8a99e844996dd610ec956f46c0d77dc7 100644 --- a/themes/blueprint/templates/RecordTab/holdingsils.phtml +++ b/themes/blueprint/templates/RecordTab/holdingsils.phtml @@ -46,7 +46,7 @@ <? if ($openUrl): ?><?=$this->openUrl($openUrl);?><? endif; ?> <? endif; ?> <? foreach ($holdings as $holding): ?> -<h3><?=$this->transEsc($holding['location'])?></h3> +<h3><?=$this->transEsc('location_' . $holding['location'], array(), $holding['location'])?></h3> <table cellpadding="2" cellspacing="0" border="0" class="citation" summary="<?=$this->transEsc('Holdings details from')?> <?=$this->transEsc($holding['location'])?>"> <? $callNos = $this->tab->getUniqueCallNumbers($holding['items']); if (!empty($callNos)): ?> <tr> diff --git a/themes/blueprint/templates/ajax/status-full.phtml b/themes/blueprint/templates/ajax/status-full.phtml index b760be9469e5efa2467bdd6770355bc85f93758d..2368f3f1f51e4ff03928b912c0093134382caa1f 100644 --- a/themes/blueprint/templates/ajax/status-full.phtml +++ b/themes/blueprint/templates/ajax/status-full.phtml @@ -8,7 +8,7 @@ <? $i = 0; foreach ($this->statusItems as $item): ?> <? if (++$i == 5) break; // Show no more than 5 items ?> <tr> - <td class="locationColumn"><?=$this->escapeHtml($item['location'])?></td> + <td class="locationColumn"><?=$this->transEsc('location_' . $item['location'], array(), $item['location'])?></td> <td class="callnumColumn"><?=$this->escapeHtml($item['callnumber'])?></td> <td class="statusColumn"> <? if (isset($item['use_unknown_message']) && $item['use_unknown_message']): ?> diff --git a/themes/bootstrap/templates/RecordTab/holdingsils.phtml b/themes/bootstrap/templates/RecordTab/holdingsils.phtml index d9297d7010dfe4ef6fc784355a9a22de870d578b..5ecf6200269c45acb1628973bb90f72eead73b36 100644 --- a/themes/bootstrap/templates/RecordTab/holdingsils.phtml +++ b/themes/bootstrap/templates/RecordTab/holdingsils.phtml @@ -46,7 +46,7 @@ <? if ($openUrl): ?><?=$this->openUrl($openUrl);?><? endif; ?> <? endif; ?> <? foreach ($holdings as $holding): ?> -<h3><?=$this->transEsc($holding['location'])?></h3> +<h3><?=$this->transEsc('location_' . $holding['location'], array(), $holding['location'])?></h3> <table class="table table-striped" summary="<?=$this->transEsc('Holdings details from')?> <?=$this->transEsc($holding['location'])?>"> <? $callNos = $this->tab->getUniqueCallNumbers($holding['items']); if (!empty($callNos)): ?> <tr> diff --git a/themes/bootstrap/templates/ajax/status-full.phtml b/themes/bootstrap/templates/ajax/status-full.phtml index 443a1a3f1db883bd328dd31394b3f00bf1dfdc79..d5d84c1e870d9707bd6c611cd1f0db348e9f9ea0 100644 --- a/themes/bootstrap/templates/ajax/status-full.phtml +++ b/themes/bootstrap/templates/ajax/status-full.phtml @@ -7,7 +7,7 @@ <? $i = 0; foreach ($this->statusItems as $item): ?> <? if (++$i == 5) break; // Show no more than 5 items ?> <tr> - <td><?=$this->escapeHtml($item['location'])?></td> + <td><?=$this->transEsc('location_' . $item['location'], array(), $item['location'])?></td> <td><?=$this->escapeHtml($item['callnumber'])?></td> <td> <? if (isset($item['use_unknown_message']) && $item['use_unknown_message']): ?> diff --git a/themes/bootstrap3/templates/RecordTab/holdingsils.phtml b/themes/bootstrap3/templates/RecordTab/holdingsils.phtml index 8e10a7af8f54ed063b2109c221b62ac3a0ec0eb7..dca7e05bee1591daf3a97b1de893c99b092b0bce 100644 --- a/themes/bootstrap3/templates/RecordTab/holdingsils.phtml +++ b/themes/bootstrap3/templates/RecordTab/holdingsils.phtml @@ -46,7 +46,7 @@ <? if ($openUrl): ?><?=$this->openUrl($openUrl);?><? endif; ?> <? endif; ?> <? foreach ($holdings as $holding): ?> -<h3><?=$this->transEsc($holding['location'])?></h3> +<h3><?=$this->transEsc('location_' . $holding['location'], array(), $holding['location'])?></h3> <table class="table table-striped" summary="<?=$this->transEsc('Holdings details from')?> <?=$this->transEsc($holding['location'])?>"> <? $callNos = $this->tab->getUniqueCallNumbers($holding['items']); if (!empty($callNos)): ?> <tr> diff --git a/themes/bootstrap3/templates/ajax/status-full.phtml b/themes/bootstrap3/templates/ajax/status-full.phtml index 5d79eca7ed2eadc32992016db209c05f305867f9..7e5404672b0552fe7875be4e809d80e9185f88a1 100644 --- a/themes/bootstrap3/templates/ajax/status-full.phtml +++ b/themes/bootstrap3/templates/ajax/status-full.phtml @@ -7,7 +7,7 @@ <? $i = 0; foreach ($this->statusItems as $item): ?> <? if (++$i == 5) break; // Show no more than 5 items ?> <tr> - <td><?=$this->escapeHtml($item['location'])?></td> + <td><?=$this->transEsc('location_' . $item['location'], array(), $item['location'])?></td> <td><?=$this->escapeHtml($item['callnumber'])?></td> <td> <? if (isset($item['use_unknown_message']) && $item['use_unknown_message']): ?> diff --git a/themes/jquerymobile/templates/RecordTab/holdingsils.phtml b/themes/jquerymobile/templates/RecordTab/holdingsils.phtml index d2f1bb380f3604a123f0f369faadf5f074a67540..cae9ae0446eb46a78c7a35033ec3ce64646f374e 100644 --- a/themes/jquerymobile/templates/RecordTab/holdingsils.phtml +++ b/themes/jquerymobile/templates/RecordTab/holdingsils.phtml @@ -34,7 +34,7 @@ <a rel="external" class="holdPlace" href="<?=$this->recordLink()->getRequestUrl($holdingTitleHold, false)?>"><?=$this->transEsc('title_hold_place')?></a> <? endif; ?> <? foreach ($holdings as $holding): ?> -<h4><?=$this->transEsc($holding['location'])?></h4> +<h4><?=$this->transEsc('location_' . $holding['location'], array(), $holding['location'])?></h4> <table class="holdings" summary="<?=$this->transEsc('Holdings details from')?> <?=$this->transEsc($holding['location'])?>"> <? $callNos = $this->tab->getUniqueCallNumbers($holding['items']); if (!empty($callNos)): ?> <tr>