From bfba519cc37ba9f8588bc257583a8b5a791161b2 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Wed, 13 Dec 2017 15:36:20 +1300 Subject: [PATCH] FIX Update translation class names and replace sprintf translations with parameters --- lang/en.yml | 5 +++-- lang/eo.yml | 4 ++-- lang/fi_FI.yml | 4 ++-- lang/hr.yml | 4 ++-- lang/mi.yml | 4 ++-- lang/zh.yml | 4 ++-- src/VersionFeedController.php | 32 +++++++++++++++++++++++--------- src/VersionFeedSiteConfig.php | 6 +++--- 8 files changed, 39 insertions(+), 24 deletions(-) diff --git a/lang/en.yml b/lang/en.yml index 5daa6d3..bb2bbd5 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -1,11 +1,12 @@ en: SilverStripe\VersionFeed\VersionFeed: LABEL: 'Make history public' - SINGLEPAGEFEEDTITLE: 'Updates to %s page' - SITEFEEDTITLE: 'Updates to %s' + SINGLEPAGEFEEDTITLE: 'Updates to {title} page' + SITEFEEDTITLE: 'Updates to {title}' TITLECHANGED: 'Title has changed:' Warning: 'Publicising the history will also disclose the changes that have at the time been protected from the public view.' Warning2: 'Changing access settings in such a way that this page or pages under it become publicly
accessible may result in publicising all historical changes on these pages too. Please review
this section''s "Public history" settings to ascertain only intended information is disclosed.' SilverStripe\VersionFeed\VersionFeedSiteConfig: ALLCHANGES: 'All page changes' ALLCHANGESLABEL: 'Make global changes feed public' + Warning: 'Publicising the history will also disclose the changes that have at the time been protected from the public view.' diff --git a/lang/eo.yml b/lang/eo.yml index cb143cf..587c73b 100644 --- a/lang/eo.yml +++ b/lang/eo.yml @@ -1,8 +1,8 @@ eo: SilverStripe\VersionFeed\VersionFeed: LABEL: 'Publikigu historion' - SINGLEPAGEFEEDTITLE: 'Ĝisdatigoj al paĝo %s' - SITEFEEDTITLE: 'Ĝisdatigoj al %s' + SINGLEPAGEFEEDTITLE: 'Ĝisdatigoj al paĝo {title}' + SITEFEEDTITLE: 'Ĝisdatigoj al {title}' TITLECHANGED: 'Titolo estas ŝanĝita:' Warning: 'Publikigi la historion ankaŭ malkaŝos la ŝanĝojn ĝis tiam protektitajn kontraŭ publika vido.' Warning2: 'Ŝanĝi la alirajn agordojn tiel ke ĉi tiu paĝo, aŭ paĝoj sub ĝi, fariĝas publike alireblaj
eble rezultigos ke publikiĝos ĉiuj historiaj ŝanĝoj en tiuj paĝoj. Bonvole rekonsideru
la sekcion "Publika historio" de ĉi tiu sekcio, por certigi ke nur intencita informo publikiĝu.' diff --git a/lang/fi_FI.yml b/lang/fi_FI.yml index e50203d..33e93b4 100644 --- a/lang/fi_FI.yml +++ b/lang/fi_FI.yml @@ -1,8 +1,8 @@ fi_FI: SilverStripe\VersionFeed\VersionFeed: LABEL: 'Tee historiasta julkinen' - SINGLEPAGEFEEDTITLE: 'Päivityksiä %s sivuun' - SITEFEEDTITLE: 'Päivityksiä: %s' + SINGLEPAGEFEEDTITLE: 'Päivityksiä {title} sivuun' + SITEFEEDTITLE: 'Päivityksiä: {title}' TITLECHANGED: 'Otsikko on muuttunut:' Warning: 'Historian julkaisu paljastaa myös muutokset, jotka ovat suojattu julkiselta tarkastelulta.' Warning2: 'Muutettaessa tämä tai sen alasivut julkisiksi,
voi toimenpide aiheuttaa myös kaiken muutoshistorian muuttumisen julkiseksi kyseisillä sivuilla. Ole hyvä
ja tarkista "Julkinen historia"-asetuksista, että vain haluttu tieto on julkaistuna.' diff --git a/lang/hr.yml b/lang/hr.yml index d3a6c61..347e0e7 100644 --- a/lang/hr.yml +++ b/lang/hr.yml @@ -1,8 +1,8 @@ hr: SilverStripe\VersionFeed\VersionFeed: LABEL: 'Učini povijest dostupnu svima' - SINGLEPAGEFEEDTITLE: 'Ažuriranja za %s stranicu' - SITEFEEDTITLE: 'Ažuriranja za %s' + SINGLEPAGEFEEDTITLE: 'Ažuriranja za {title} stranicu' + SITEFEEDTITLE: 'Ažuriranja za {title}' TITLECHANGED: 'Naziv se promijenio:' Warning: 'Objavom povijesti će se također otkriti promjene koje su u to vrijeme bili zaštićeni od očiju javnosti.' Warning2: 'Promjenom postavki pristupi na takav način će učiniti da ova stranica ili stranice ispod nje postanu javno
dostupne mogu rezultirati objavomm svih povijesnih promjena na tim stranicama također. Molimo pregledajte
podatke sekcije "Public history" da budete sigurni samo željene informacije da su prikazane.' diff --git a/lang/mi.yml b/lang/mi.yml index 56500d7..7f0e5b4 100644 --- a/lang/mi.yml +++ b/lang/mi.yml @@ -1,8 +1,8 @@ mi: SilverStripe\VersionFeed\VersionFeed: LABEL: 'Meinga kia tūmatanui te hītori' - SINGLEPAGEFEEDTITLE: 'Ngā whakahou ki te whārangi %s' - SITEFEEDTITLE: 'Ngā whakahou ki te %s' + SINGLEPAGEFEEDTITLE: 'Ngā whakahou ki te whārangi {title}' + SITEFEEDTITLE: 'Ngā whakahou ki te {title}' TITLECHANGED: 'Kua hurihia te taitara:' Warning: 'Mā te whakarite kia tūmatanui te hītori ka whakaaturia hoki ngā huringa o mua tērā i hunaia i te tirohanga tūmatanui.' Warning2: 'Mā te huri i ngā tautuhinga uru kia noho wātea
tūmatanui ai tēnei whārangi, ngā whārangi rānei i raro i taua whārangi, tērā pea ko te mutunga iho ko te wātea tūmatanui o ngā huringa hītori katoa i aua whārangi. Me arotake
ngā tautuhinga "Hītori tūmatanui" o tēnei wāhanga kia mōhio ai ka whakaaturia anake ngā mōhiohio ka hiahiatia.' diff --git a/lang/zh.yml b/lang/zh.yml index e11cf98..49f79ab 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -1,8 +1,8 @@ zh: SilverStripe\VersionFeed\VersionFeed: LABEL: '将历史记录公开' - SINGLEPAGEFEEDTITLE: '更新至 %s 页面' - SITEFEEDTITLE: '更新至 %s' + SINGLEPAGEFEEDTITLE: '更新至 {title} 页面' + SITEFEEDTITLE: '更新至 {title}' TITLECHANGED: '标题已更改:' Warning: '发布历史记录还会在公开视图中显示受保护事件内进行的改动。' Warning2: '用这种方式更改访问设置会使得本页及下级页面变为公开的
可能还会使得这些页面的所有变动历史记录也变为公开的。请查阅
本节的“公开历史记录”设置,确保只将需要的信息披露出来。' diff --git a/src/VersionFeedController.php b/src/VersionFeedController.php index c21c282..ed20188 100644 --- a/src/VersionFeedController.php +++ b/src/VersionFeedController.php @@ -3,14 +3,12 @@ namespace SilverStripe\VersionFeed; use SilverStripe\Core\Config\Config; -use SilverStripe\VersionFeed\VersionFeed; use SilverStripe\Control\RSS\RSSFeed; use SilverStripe\SiteConfig\SiteConfig; use SilverStripe\ORM\DB; use SilverStripe\Security\Member; use SilverStripe\ORM\ArrayList; use SilverStripe\CMS\Model\SiteTree; -use SilverStripe\Versioned\Versioned_Version; use SilverStripe\Core\Convert; use SilverStripe\View\Requirements; use SilverStripe\Core\Extension; @@ -18,7 +16,6 @@ use SilverStripe\VersionFeed\Filters\ContentFilter; class VersionFeedController extends Extension { - private static $allowed_actions = array( 'changes', 'allchanges' @@ -84,7 +81,11 @@ class VersionFeedController extends Extension }); // Generate the output. - $title = sprintf(_t(VersionFeed::class . '.SINGLEPAGEFEEDTITLE', 'Updates to %s page'), $this->owner->Title); + $title = _t( + 'SilverStripe\\VersionFeed\\VersionFeed.SINGLEPAGEFEEDTITLE', + 'Updates to {title} page', + ['title' => $this->owner->Title] + ); $rss = new RSSFeed($entries, $this->owner->request->getURL(), $title, '', 'Title', '', null); $rss->setTemplate('Page_changes_rss'); return $rss->outputToBrowser(); @@ -148,7 +149,15 @@ class VersionFeedController extends Extension // Produce output $url = $this->owner->getRequest()->getURL(); - $rss = new RSSFeed($changeList, $url, $this->linkToAllSitesRSSFeedTitle(), '', 'Title', '', null); + $rss = new RSSFeed( + $changeList, + $url, + $this->linkToAllSitesRSSFeedTitle(), + '', + 'Title', + '', + null + ); $rss->setTemplate('Page_allchanges_rss'); return $rss->outputToBrowser(); } @@ -164,9 +173,10 @@ class VersionFeedController extends Extension RSSFeed::linkToFeed( $this->owner->Link('changes'), - sprintf( - _t(VersionFeed::class . '.SINGLEPAGEFEEDTITLE', 'Updates to %s page'), - $this->owner->Title + _t( + 'SilverStripe\\VersionFeed\\VersionFeed.SINGLEPAGEFEEDTITLE', + 'Updates to {title} page', + ['title' => $this->owner->Title] ) ); } @@ -194,6 +204,10 @@ class VersionFeedController extends Extension public function linkToAllSitesRSSFeedTitle() { - return sprintf(_t(VersionFeed::class . '.SITEFEEDTITLE', 'Updates to %s'), SiteConfig::current_site_config()->Title); + return _t( + 'SilverStripe\\VersionFeed\\VersionFeed.SITEFEEDTITLE', + 'Updates to {title}', + ['title' => SiteConfig::current_site_config()->Title] + ); } } diff --git a/src/VersionFeedSiteConfig.php b/src/VersionFeedSiteConfig.php index 32420e0..d6bbaba 100644 --- a/src/VersionFeedSiteConfig.php +++ b/src/VersionFeedSiteConfig.php @@ -25,7 +25,7 @@ class VersionFeedSiteConfig extends DataExtension public function updateFieldLabels(&$labels) { - $labels['AllChangesEnabled'] = _t(VersionFeedSiteConfig::class . '.ALLCHANGESLABEL', 'Make global changes feed public'); + $labels['AllChangesEnabled'] = _t(__CLASS__ . '.ALLCHANGESLABEL', 'Make global changes feed public'); } public function updateCMSFields(FieldList $fields) @@ -37,9 +37,9 @@ class VersionFeedSiteConfig extends DataExtension $fields->addFieldToTab( 'Root.Access', FieldGroup::create(new CheckboxField('AllChangesEnabled', $this->owner->fieldLabel('AllChangesEnabled'))) - ->setTitle(_t(VersionFeedSiteConfig::class . '.ALLCHANGES', 'All page changes')) + ->setTitle(_t(__CLASS__ . '.ALLCHANGES', 'All page changes')) ->setDescription(_t( - VersionFeed::class . '.Warning', + __CLASS__ . '.Warning', "Publicising the history will also disclose the changes that have at the time been protected " . "from the public view." ))