Support localized licenses

HFP-1079
pull/23/merge
Frode Petterson 2017-05-30 15:23:25 +02:00
parent 42e0c99fd3
commit 59fd08594f
2 changed files with 92 additions and 31 deletions

View File

@ -3007,6 +3007,67 @@ class H5PCore {
return $can; return $can;
} }
/**
* Provide localization for the Core JS
* @return array
*/
public function getLocalization() {
return array(
'fullscreen' => $this->h5pF->t('Fullscreen'),
'disableFullscreen' => $this->h5pF->t('Disable fullscreen'),
'download' => $this->h5pF->t('Download'),
'copyrights' => $this->h5pF->t('Rights of use'),
'embed' => $this->h5pF->t('Embed'),
'size' => $this->h5pF->t('Size'),
'showAdvanced' => $this->h5pF->t('Show advanced'),
'hideAdvanced' => $this->h5pF->t('Hide advanced'),
'advancedHelp' => $this->h5pF->t('Include this script on your website if you want dynamic sizing of the embedded content:'),
'copyrightInformation' => $this->h5pF->t('Rights of use'),
'close' => $this->h5pF->t('Close'),
'title' => $this->h5pF->t('Title'),
'author' => $this->h5pF->t('Author'),
'year' => $this->h5pF->t('Year'),
'source' => $this->h5pF->t('Source'),
'license' => $this->h5pF->t('License'),
'thumbnail' => $this->h5pF->t('Thumbnail'),
'noCopyrights' => $this->h5pF->t('No copyright information available for this content.'),
'downloadDescription' => $this->h5pF->t('Download this content as a H5P file.'),
'copyrightsDescription' => $this->h5pF->t('View copyright information for this content.'),
'embedDescription' => $this->h5pF->t('View the embed code for this content.'),
'h5pDescription' => $this->h5pF->t('Visit H5P.org to check out more cool content.'),
'contentChanged' => $this->h5pF->t('This content has changed since you last used it.'),
'startingOver' => $this->h5pF->t("You'll be starting over."),
'by' => $this->h5pF->t('by'),
'showMore' => $this->h5pF->t('Show more'),
'showLess' => $this->h5pF->t('Show less'),
'subLevel' => $this->h5pF->t('Sublevel'),
'confirmDialogHeader' => $this->h5pF->t('Confirm action'),
'confirmDialogBody' => $this->h5pF->t('Please confirm that you wish to proceed. This action is not reversible.'),
'cancelLabel' => $this->h5pF->t('Cancel'),
'confirmLabel' => $this->h5pF->t('Confirm'),
'licenseU' => $this->h5pF->t('Undisclosed'),
'licenseCCBY' => $this->h5pF->t('Attribution'),
'licenseCCBYSA' => $this->h5pF->t('Attribution-ShareAlike'),
'licenseCCBYND' => $this->h5pF->t('Attribution-NoDerivs'),
'licenseCCBYNC' => $this->h5pF->t('Attribution-NonCommercial'),
'licenseCCBYNCSA' => $this->h5pF->t('Attribution-NonCommercial-ShareAlike'),
'licenseCCBYNCND' => $this->h5pF->t('Attribution-NonCommercial-NoDerivs'),
'licenseCC40' => $this->h5pF->t('4.0 International'),
'licenseCC30' => $this->h5pF->t('3.0 Unported'),
'licenseCC25' => $this->h5pF->t('2.5 Generic'),
'licenseCC20' => $this->h5pF->t('2.0 Generic'),
'licenseCC10' => $this->h5pF->t('1.0 Generic'),
'licenseGPL' => $this->h5pF->t('General Public License'),
'licenseV3' => $this->h5pF->t('Version 3'),
'licenseV2' => $this->h5pF->t('Version 2'),
'licenseV1' => $this->h5pF->t('Version 1'),
'licensePD' => $this->h5pF->t('Public Domain'),
'licenseCC010' => $this->h5pF->t('CC0 1.0 Universal'),
'licensePDM' => $this->h5pF->t('Public Domain Mark'),
'licenseC' => $this->h5pF->t('Copyright')
);
}
} }
/** /**
@ -3931,23 +3992,23 @@ class H5PContentValidator {
$cc_versions = array( $cc_versions = array(
(object) array( (object) array(
'value' => '4.0', 'value' => '4.0',
'label' => '4.0 International' 'label' => $this->h5pF->t('4.0 International')
), ),
(object) array( (object) array(
'value' => '3.0', 'value' => '3.0',
'label' => '3.0 Unported' 'label' => $this->h5pF->t('3.0 Unported')
), ),
(object) array( (object) array(
'value' => '2.5', 'value' => '2.5',
'label' => '2.5 Generic' 'label' => $this->h5pF->t('2.5 Generic')
), ),
(object) array( (object) array(
'value' => '2.0', 'value' => '2.0',
'label' => '2.0 Generic' 'label' => $this->h5pF->t('2.0 Generic')
), ),
(object) array( (object) array(
'value' => '1.0', 'value' => '1.0',
'label' => '1.0 Generic' 'label' => $this->h5pF->t('1.0 Generic')
) )
); );
@ -4034,15 +4095,15 @@ class H5PContentValidator {
'versions' => array( 'versions' => array(
(object) array( (object) array(
'value' => 'v3', 'value' => 'v3',
'label' => 'Version 3' 'label' => $this->h5pF->t('Version 3')
), ),
(object) array( (object) array(
'value' => 'v2', 'value' => 'v2',
'label' => 'Version 2' 'label' => $this->h5pF->t('Version 2')
), ),
(object) array( (object) array(
'value' => 'v1', 'value' => 'v1',
'label' => 'Version 1' 'label' => $this->h5pF->t('Version 1')
) )
) )
), ),
@ -4056,11 +4117,11 @@ class H5PContentValidator {
), ),
(object) array( (object) array(
'value' => 'CC0 1.0', 'value' => 'CC0 1.0',
'label' => 'CC0 1.0 Universal' 'label' => $this->h5pF->t('CC0 1.0 Universal')
), ),
(object) array( (object) array(
'value' => 'CC PDM', 'value' => 'CC PDM',
'label' => 'Public Domain Mark' 'label' => $this->h5pF->t('Public Domain Mark')
) )
) )
), ),

View File

@ -1389,11 +1389,11 @@ H5P.MediaCopyright = function (copyright, labels, order, extraFields) {
(function () { (function () {
var ccVersions = { var ccVersions = {
'4.0': '4.0 International', '4.0': H5P.t('licenseCC40'),
'3.0': '3.0 Unported', '3.0': H5P.t('licenseCC30'),
'2.5': '2.5 Generic', '2.5': H5P.t('licenseCC25'),
'2.0': '2.0 Generic', '2.0': H5P.t('licenseCC20'),
'1.0': '1.0 Generic' '1.0': H5P.t('licenseCC10'),
}; };
/** /**
@ -1402,39 +1402,39 @@ H5P.MediaCopyright = function (copyright, labels, order, extraFields) {
* @type {Object} * @type {Object}
*/ */
H5P.copyrightLicenses = { H5P.copyrightLicenses = {
'U': 'Undisclosed', 'U': H5P.t('licenseU'),
'CC BY': { 'CC BY': {
label: 'Attribution', label: H5P.t('licenseCCBY'),
link: 'http://creativecommons.org/licenses/by/:version/legalcode', link: 'http://creativecommons.org/licenses/by/:version/legalcode',
versions: ccVersions versions: ccVersions
}, },
'CC BY-SA': { 'CC BY-SA': {
label: 'Attribution-ShareAlike', label: H5P.t('licenseCCBYSA'),
link: 'http://creativecommons.org/licenses/by-sa/:version/legalcode', link: 'http://creativecommons.org/licenses/by-sa/:version/legalcode',
versions: ccVersions versions: ccVersions
}, },
'CC BY-ND': { 'CC BY-ND': {
label: 'Attribution-NoDerivs', label: H5P.t('licenseCCBYND'),
link: 'http://creativecommons.org/licenses/by-nd/:version/legalcode', link: 'http://creativecommons.org/licenses/by-nd/:version/legalcode',
versions: ccVersions versions: ccVersions
}, },
'CC BY-NC': { 'CC BY-NC': {
label: 'Attribution-NonCommercial', label: H5P.t('licenseCCBYNC'),
link: 'http://creativecommons.org/licenses/by-nc/:version/legalcode', link: 'http://creativecommons.org/licenses/by-nc/:version/legalcode',
versions: ccVersions versions: ccVersions
}, },
'CC BY-NC-SA': { 'CC BY-NC-SA': {
label: 'Attribution-NonCommercial-ShareAlike', label: H5P.t('licenseCCBYNCSA'),
link: 'http://creativecommons.org/licenses/by-nc-sa/:version/legalcode', link: 'http://creativecommons.org/licenses/by-nc-sa/:version/legalcode',
versions: ccVersions versions: ccVersions
}, },
'CC BY-NC-ND': { 'CC BY-NC-ND': {
label: 'Attribution-NonCommercial-NoDerivs', label: H5P.t('licenseCCBYNCND'),
link: 'http://creativecommons.org/licenses/by-nc-nd/:version/legalcode', link: 'http://creativecommons.org/licenses/by-nc-nd/:version/legalcode',
versions: ccVersions versions: ccVersions
}, },
'GNU GPL': { 'GNU GPL': {
label: 'General Public License', label: H5P.t('licenseGPL'),
link: 'http://www.gnu.org/licenses/gpl-:version-standalone.html', link: 'http://www.gnu.org/licenses/gpl-:version-standalone.html',
linkVersions: { linkVersions: {
'v3': '3.0', 'v3': '3.0',
@ -1442,27 +1442,27 @@ H5P.MediaCopyright = function (copyright, labels, order, extraFields) {
'v1': '1.0' 'v1': '1.0'
}, },
versions: { versions: {
'v3': 'Version 3', 'v3': H5P.t('licenseV3'),
'v2': 'Version 2', 'v2': H5P.t('licenseV2'),
'v1': 'Version 1' 'v1': H5P.t('licenseV1')
} }
}, },
'PD': { 'PD': {
label: 'Public Domain', label: H5P.t('licensePD'),
versions: { versions: {
'CC0 1.0': { 'CC0 1.0': {
label: 'CC0 1.0 Universal (CC0 1.0) Public Domain Dedication', label: H5P.t('licenseCC010'),
link: 'https://creativecommons.org/publicdomain/zero/1.0/' link: 'https://creativecommons.org/publicdomain/zero/1.0/'
}, },
'CC PDM': { 'CC PDM': {
label: 'Public Domain Mark', label: H5P.t('licensePDM'),
link: 'https://creativecommons.org/publicdomain/mark/1.0/' link: 'https://creativecommons.org/publicdomain/mark/1.0/'
} }
} }
}, },
'ODC PDDL': '<a href="http://opendatacommons.org/licenses/pddl/1.0/" target="_blank">Public Domain Dedication and Licence</a>', 'ODC PDDL': '<a href="http://opendatacommons.org/licenses/pddl/1.0/" target="_blank">Public Domain Dedication and Licence</a>',
'CC PDM': 'Public Domain Mark', 'CC PDM': H5P.t('licensePDM'),
'C': 'Copyright' 'C': H5P.t('licenseC'),
}; };
})(); })();