Makes Dublin Core Labels translatable. #850.

This commit is contained in:
mateuswetah 2024-04-02 11:19:10 -03:00
parent bfef4dcd01
commit bff3278fe4
2 changed files with 72 additions and 50 deletions

View File

@ -16,56 +16,6 @@ class Dublin_Core extends Mapper {
public $prefixes = [
'dc' => 'http://purl.org/dc/elements/1.1/'
];
public $metadata = [
'dc:contributor' => [
'label' => 'Contributor'
],
'dc:coverage' => [
'label' => 'Coverage'
],
'dc:creator' => [
'label' => 'Creator',
],
'dc:date' => [
'label' => 'Date',
'metadata_type' => 'date'
],
'dc:description' => [
'label' => 'Description',
'core_metadatum' => 'description'
],
'dc:format' => [
'label' => 'Format',
],
'dc:identifier' => [
'label' => 'Identifier'
],
'dc:language' => [
'label' => 'Language'
],
'dc:publisher' => [
'label' => 'Publisher'
],
'dc:relation' => [
'label' => 'Relation'
],
'dc:rights' => [
'label' => 'Rights'
],
'dc:source' => [
'label' => 'Source'
],
'dc:subject' => [
'label' => 'Subject'
],
'dc:title' => [
'label' => 'Title',
'core_metadatum' => 'title'
],
'dc:type' => [
'label' => 'Type'
]
];
/** XML especial case **/
const XML_DC_NAMESPACE = 'http://purl.org/dc/elements/1.1/';
@ -73,5 +23,76 @@ class Dublin_Core extends Mapper {
public $XML_namespace = 'http://purl.org/dc/elements/1.1/';
public $XML_append_root = 'rdf:Description';
/** END: XML especial case **/
function __construct() {
parent::__construct();
/* Metadata should be set here to allow translable labels */
$this->metadata = [
'dc:contributor' => [
/* translators: Label for the dc:contributor field in the Dublin Core standard */
'label' => __( 'Contributor', 'tainacan')
],
'dc:coverage' => [
/* translators: Label for the dc:coverage field in the Dublin Core standard */
'label' => __( 'Coverage', 'tainacan')
],
'dc:creator' => [
/* translators: Label for the dc:creator field in the Dublin Core standard */
'label' => __( 'Creator', 'tainacan')
],
'dc:date' => [
/* translators: Label for the dc:date field in the Dublin Core standard */
'label' => __( 'Date', 'tainacan'),
'metadata_type' => 'date'
],
'dc:description' => [
/* translators: Label for the dc:description field in the Dublin Core standard */
'label' => __( 'Description', 'tainacan'),
'core_metadatum' => 'description'
],
'dc:format' => [
/* translators: Label for the dc:format field in the Dublin Core standard */
'label' => __( 'Format', 'tainacan')
],
'dc:identifier' => [
/* translators: Label for the dc:identifier field in the Dublin Core standard */
'label' => __( 'Identifier', 'tainacan')
],
'dc:language' => [
/* translators: Label for the dc:language field in the Dublin Core standard */
'label' => __( 'Language', 'tainacan')
],
'dc:publisher' => [
/* translators: Label for the dc:publisher field in the Dublin Core standard */
'label' => __( 'Publisher', 'tainacan')
],
'dc:relation' => [
/* translators: Label for the dc:relation field in the Dublin Core standard */
'label' => __( 'Relation', 'tainacan')
],
'dc:rights' => [
/* translators: Label for the dc:rights field in the Dublin Core standard */
'label' => __( 'Rights', 'tainacan')
],
'dc:source' => [
/* translators: Label for the dc:source field in the Dublin Core standard */
'label' => __( 'Source', 'tainacan')
],
'dc:subject' => [
/* translators: Label for the dc:subject field in the Dublin Core standard */
'label' => __( 'Subject', 'tainacan')
],
'dc:title' => [
/* translators: Label for the dc:title field in the Dublin Core standard */
'label' => __( 'Title', 'tainacan'),
'core_metadatum' => 'title'
],
'dc:type' => [
/* translators: Label for the dc:type field in the Dublin Core standard */
'label' => __( 'Type', 'tainacan')
]
];
}
}

View File

@ -66,4 +66,5 @@ abstract class Mapper {
return $url;
}
function __construct() {}
}