Browse Source

Added i18n support for DC metadata labels.

pull/424/head
Nigel Banks 11 years ago
parent
commit
bb54167141
  1. 10
      README.md
  2. 5
      includes/dublin_core.inc
  3. 42
      islandora.module

10
README.md

@ -26,9 +26,17 @@ REQUIREMENTS
The Tuque library must be installed to use Islandora. It can be found here: The Tuque library must be installed to use Islandora. It can be found here:
http://github.com/Islandora/tuque http://github.com/Islandora/tuque
It is expected to be in one of two paths: It is expected to be in one of two paths:
- sites/all/libraries/tuque (libraries directory may need to be created) - sites/all/libraries/tuque (libraries directory may need to be created)
- islandora_folder/libraries/tuque - islandora_folder/libraries/tuque
OPTIONAL REQUIREMENTS
---------------------
If you want to support languages other than English download and enable
[String Translation](https://drupal.org/project/i18n), And follow our
[guide](wiki/Multilingual-Support) for setting up additional languges.
INSTALLATION INSTALLATION
------------ ------------

5
includes/dublin_core.inc

@ -130,7 +130,10 @@ class DublinCore {
} }
$dc_label = explode(':', $field); $dc_label = explode(':', $field);
$element_label = drupal_ucfirst($dc_label[1]); $element_label = drupal_ucfirst($dc_label[1]);
$dc_array[$field]['label'] = $element_label; $i18n_object_id = drupal_strtolower($element_label);
$dc_array[$field]['label'] = function_exists('i18n_string') ?
i18n_string("islandora:dc:{$i18n_object_id}:label", $element_label) :
$element_label;
$dc_array[$field]['value'] = filter_xss($value); $dc_array[$field]['value'] = filter_xss($value);
$dc_array[$field]['class'] = drupal_strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $field)); $dc_array[$field]['class'] = drupal_strtolower(preg_replace('/[^A-Za-z0-9]/', '-', $field));
$dc_array[$field]['dcterms'] = preg_replace('/^dc/', 'dcterms', $field); $dc_array[$field]['dcterms'] = preg_replace('/^dc/', 'dcterms', $field);

42
islandora.module

@ -532,6 +532,48 @@ function islandora_permission() {
); );
} }
/**
* Implements hook_i18n_string_info().
*/
function islandora_i18n_string_info() {
return array(
'islandora' => array(
'title' => t('Islandora'),
'description' => t('Translatable Metadata labels, etc.'),
'format' => FALSE,
'list' => TRUE,
),
);
}
/**
* Implements islandora_i18n_string_list().
*/
function islandora_i18n_string_list($group) {
if ($group == 'islandora') {
return array(
'islandora' => array(
'dc' => array(
'title' => array('label' => 'Title'),
'creator' => array('label' => 'Creator'),
'subject' => array('label' => 'Subject'),
'description' => array('label' => 'Description'),
'publisher' => array('label' => 'Publisher'),
'contributor' => array('label' => 'Contributor'),
'date' => array('label' => 'Date'),
'type' => array('label' => 'Type'),
'format' => array('label' => 'Format'),
'identifier' => array('label' => 'Identifier'),
'source' => array('label' => 'Source'),
'language' => array('label' => 'Language'),
'relation' => array('label' => 'Relation'),
'coverage' => array('label' => 'Coverage'),
),
),
);
}
}
/** /**
* Renders the print page for the given object. * Renders the print page for the given object.
* *

Loading…
Cancel
Save