From 59fd08594f5c2c86570073fa8b5c7567e4dfa9ad Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Tue, 30 May 2017 15:23:25 +0200 Subject: [PATCH] Support localized licenses HFP-1079 --- h5p.classes.php | 81 +++++++++++++++++++++++++++++++++++++++++++------ js/h5p.js | 42 ++++++++++++------------- 2 files changed, 92 insertions(+), 31 deletions(-) diff --git a/h5p.classes.php b/h5p.classes.php index 61f6be2..d325e3d 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -3007,6 +3007,67 @@ class H5PCore { 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( (object) array( 'value' => '4.0', - 'label' => '4.0 International' + 'label' => $this->h5pF->t('4.0 International') ), (object) array( 'value' => '3.0', - 'label' => '3.0 Unported' + 'label' => $this->h5pF->t('3.0 Unported') ), (object) array( 'value' => '2.5', - 'label' => '2.5 Generic' + 'label' => $this->h5pF->t('2.5 Generic') ), (object) array( 'value' => '2.0', - 'label' => '2.0 Generic' + 'label' => $this->h5pF->t('2.0 Generic') ), (object) array( 'value' => '1.0', - 'label' => '1.0 Generic' + 'label' => $this->h5pF->t('1.0 Generic') ) ); @@ -4034,15 +4095,15 @@ class H5PContentValidator { 'versions' => array( (object) array( 'value' => 'v3', - 'label' => 'Version 3' + 'label' => $this->h5pF->t('Version 3') ), (object) array( 'value' => 'v2', - 'label' => 'Version 2' + 'label' => $this->h5pF->t('Version 2') ), (object) array( 'value' => 'v1', - 'label' => 'Version 1' + 'label' => $this->h5pF->t('Version 1') ) ) ), @@ -4056,11 +4117,11 @@ class H5PContentValidator { ), (object) array( 'value' => 'CC0 1.0', - 'label' => 'CC0 1.0 Universal' + 'label' => $this->h5pF->t('CC0 1.0 Universal') ), (object) array( 'value' => 'CC PDM', - 'label' => 'Public Domain Mark' + 'label' => $this->h5pF->t('Public Domain Mark') ) ) ), diff --git a/js/h5p.js b/js/h5p.js index 25119ef..22b5de5 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -1389,11 +1389,11 @@ H5P.MediaCopyright = function (copyright, labels, order, extraFields) { (function () { var ccVersions = { - '4.0': '4.0 International', - '3.0': '3.0 Unported', - '2.5': '2.5 Generic', - '2.0': '2.0 Generic', - '1.0': '1.0 Generic' + '4.0': H5P.t('licenseCC40'), + '3.0': H5P.t('licenseCC30'), + '2.5': H5P.t('licenseCC25'), + '2.0': H5P.t('licenseCC20'), + '1.0': H5P.t('licenseCC10'), }; /** @@ -1402,39 +1402,39 @@ H5P.MediaCopyright = function (copyright, labels, order, extraFields) { * @type {Object} */ H5P.copyrightLicenses = { - 'U': 'Undisclosed', + 'U': H5P.t('licenseU'), 'CC BY': { - label: 'Attribution', + label: H5P.t('licenseCCBY'), link: 'http://creativecommons.org/licenses/by/:version/legalcode', versions: ccVersions }, 'CC BY-SA': { - label: 'Attribution-ShareAlike', + label: H5P.t('licenseCCBYSA'), link: 'http://creativecommons.org/licenses/by-sa/:version/legalcode', versions: ccVersions }, 'CC BY-ND': { - label: 'Attribution-NoDerivs', + label: H5P.t('licenseCCBYND'), link: 'http://creativecommons.org/licenses/by-nd/:version/legalcode', versions: ccVersions }, 'CC BY-NC': { - label: 'Attribution-NonCommercial', + label: H5P.t('licenseCCBYNC'), link: 'http://creativecommons.org/licenses/by-nc/:version/legalcode', versions: ccVersions }, 'CC BY-NC-SA': { - label: 'Attribution-NonCommercial-ShareAlike', + label: H5P.t('licenseCCBYNCSA'), link: 'http://creativecommons.org/licenses/by-nc-sa/:version/legalcode', versions: ccVersions }, 'CC BY-NC-ND': { - label: 'Attribution-NonCommercial-NoDerivs', + label: H5P.t('licenseCCBYNCND'), link: 'http://creativecommons.org/licenses/by-nc-nd/:version/legalcode', versions: ccVersions }, 'GNU GPL': { - label: 'General Public License', + label: H5P.t('licenseGPL'), link: 'http://www.gnu.org/licenses/gpl-:version-standalone.html', linkVersions: { 'v3': '3.0', @@ -1442,27 +1442,27 @@ H5P.MediaCopyright = function (copyright, labels, order, extraFields) { 'v1': '1.0' }, versions: { - 'v3': 'Version 3', - 'v2': 'Version 2', - 'v1': 'Version 1' + 'v3': H5P.t('licenseV3'), + 'v2': H5P.t('licenseV2'), + 'v1': H5P.t('licenseV1') } }, 'PD': { - label: 'Public Domain', + label: H5P.t('licensePD'), versions: { '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/' }, 'CC PDM': { - label: 'Public Domain Mark', + label: H5P.t('licensePDM'), link: 'https://creativecommons.org/publicdomain/mark/1.0/' } } }, 'ODC PDDL': 'Public Domain Dedication and Licence', - 'CC PDM': 'Public Domain Mark', - 'C': 'Copyright' + 'CC PDM': H5P.t('licensePDM'), + 'C': H5P.t('licenseC'), }; })();