Skip to content

Commit

Permalink
Update translations and update classes to use __CLASS__ in translations
Browse files Browse the repository at this point in the history
  • Loading branch information
raissanorth committed Jan 8, 2018
1 parent f1c58fd commit edef740
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 72 deletions.
60 changes: 32 additions & 28 deletions lang/en.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
en:
ContentReview:
SilverStripe\ContentReview\Extensions\ContentReviewCMSExtension:
ErrorItemPermissionDenied: 'It seems you don''t have the necessary permissions to review this content'
SilverStripe\ContentReview\Extensions\ContentReviewDefaultSettings:
ADDGROUP: 'Add groups'
ADDUSERS: 'Add users'
BUTTONREVIEWED: 'Review content'
COMMENTS: '(optional) Add comments...'
CONTENTOWNERS: 'Content Owners'
CONTENTREVIEW: 'Content due for review'
CUSTOM: 'Custom settings'
DEFAULTSETTINGSHELP: 'These settings will apply to all pages that do not have a specific Content Review schedule.'
DISABLE: 'Disable content review'
EMAILFROM: 'From email address'
EMAILFROM_RIGHTTITLE: 'e.g: [email protected]'
EMAILSUBJECT: 'Subject line'
EMAILTEMPLATE: 'Email template'
OWNERGROUPSDESCRIPTION: 'Page owners that are responsible for reviews'
OWNERUSERSDESCRIPTION: 'Page owners that are responsible for reviews'
PAGEOWNERGROUPS: Groups
PAGEOWNERUSERS: Users
REVIEWFREQUENCY: 'Review frequency'
REVIEWFREQUENCYDESCRIPTION: 'The review date will be set to this far in the future, whenever the page is published.'
SilverStripe\ContentReview\Extensions\SiteTreeContentReview:
ADDGROUP: 'Add groups'
ADDUSERS: 'Add users'
CONTENTOWNERS: 'Content Owners'
CONTENTREVIEW: 'Content due for review'
CUSTOM: 'Custom settings'
DISABLE: 'Disable content review'
INHERIT: 'Inherit from parent page'
MARKREVIEWED: 'Mark as reviewed'
NEXTREVIEWDATADESCRIPTION: 'Leave blank for no review'
NEXTREVIEWDATE: 'Next review date'
NOCOMMENTS: '(no comments)'
OPTIONS: Options
OWNERGROUPSDESCRIPTION: 'Page owners that are responsible for reviews'
OWNERUSERSDESCRIPTION: 'Page owners that are responsible for reviews'
Expand All @@ -25,31 +33,27 @@ en:
REVIEWFREQUENCY: 'Review frequency'
REVIEWFREQUENCYDESCRIPTION: 'The review date will be set to this far in the future whenever the page is published'
REVIEWHEADER: 'Content review'
REVIEWNOTES: 'Review notes'
REVIEWSUCCESSFUL: 'Content reviewed successfully'
SAVE: Save
SETTINGSFROM: 'Options are'
ContentReviewEmails:
REVIEWPAGELINK: 'Review the page in the CMS'
SUBJECT: 'Page(s) are due for content review'
VIEWPUBLISHEDLINK: 'View this page on the website'
ContentReviewLog:
SilverStripe\ContentReview\Forms\ReviewContentHandler:
ErrorReviewPermissionDenied: 'It seems you don''t have the necessary permissions to submit a content review'
MarkAsReviewedAction: 'Mark as reviewed'
NoComments: '(no comments)'
Placeholder: 'Add comments (optional)'
Success: 'Review successfully added'
SilverStripe\ContentReview\Models\ContentReviewLog:
PLURALNAME: 'Content Review Logs'
PLURALS:
one: 'A Content Review Log'
other: '{count} Content Review Logs'
SINGULARNAME: 'Content Review Log'
PagesDueForReviewReport:
SilverStripe\ContentReview\Reports\PagesDueForReviewReport:
ONLYMYPAGES: 'Only Show pages assigned to me'
REVIEWDATEAFTER: 'Review date after or on'
REVIEWDATEBEFORE: 'Review date before or on'
SHOWVIRTUALPAGES: 'Show Virtual Pages'
TITLE: 'Pages due for review'
PagesWithoutReviewScheduleReport:
SilverStripe\ContentReview\Reports\PagesWithoutReviewScheduleReport:
TITLE: 'Pages without a scheduled review.'
Review:
EMAILFROM_RIGHTTITLE: 'e.g: [email protected]'

SilverStripe\ContentReview\Forms\ReviewContentHandler:
ContentDueForReview: Content due for review
MarkAsReviewedAction: Mark as reviewed
NoComments: (no comments)
Placeholder: Add comments (optional)
Success: Review successfully added
SilverStripe\ContentReview\Tasks\ContentReviewEmails:
REVIEWPAGELINK: 'Review the page in the CMS'
VIEWPUBLISHEDLINK: 'View this page on the website'
26 changes: 13 additions & 13 deletions src/Extensions/ContentReviewDefaultSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function updateCMSFields(FieldList $fields)
$helpText = LiteralField::create(
'ContentReviewHelp',
_t(
'ContentReview.DEFAULTSETTINGSHELP',
__CLASS__ . '.DEFAULTSETTINGSHELP',
'These settings will apply to all pages that do not have a specific Content Review schedule.'
)
);
Expand All @@ -117,11 +117,11 @@ public function updateCMSFields(FieldList $fields)

$reviewFrequency = DropdownField::create(
'ReviewPeriodDays',
_t('ContentReview.REVIEWFREQUENCY', 'Review frequency'),
_t(__CLASS__ . '.REVIEWFREQUENCY', 'Review frequency'),
SiteTreeContentReview::get_schedule()
)
->setDescription(_t(
'ContentReview.REVIEWFREQUENCYDESCRIPTION',
__CLASS__ . '.REVIEWFREQUENCYDESCRIPTION',
'The review date will be set to this far in the future, whenever the page is published.'
));

Expand All @@ -135,9 +135,9 @@ public function updateCMSFields(FieldList $fields)
$usersMap = $users->map('ID', 'Title')->toArray();
asort($usersMap);

$userField = ListboxField::create('OwnerUsers', _t('ContentReview.PAGEOWNERUSERS', 'Users'), $usersMap)
->setAttribute('data-placeholder', _t('ContentReview.ADDUSERS', 'Add users'))
->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));
$userField = ListboxField::create('OwnerUsers', _t(__CLASS__ . '.PAGEOWNERUSERS', 'Users'), $usersMap)
->setAttribute('data-placeholder', _t(__CLASS__ . '.ADDUSERS', 'Add users'))
->setDescription(_t(__CLASS__ . '.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));

$fields->addFieldToTab('Root.ContentReview', $userField);

Expand All @@ -150,20 +150,20 @@ public function updateCMSFields(FieldList $fields)

asort($groupsMap);

$groupField = ListboxField::create('OwnerGroups', _t('ContentReview.PAGEOWNERGROUPS', 'Groups'), $groupsMap)
->setAttribute('data-placeholder', _t('ContentReview.ADDGROUP', 'Add groups'))
->setDescription(_t('ContentReview.OWNERGROUPSDESCRIPTION', 'Page owners that are responsible for reviews'));
$groupField = ListboxField::create('OwnerGroups', _t(__CLASS__ . '.PAGEOWNERGROUPS', 'Groups'), $groupsMap)
->setAttribute('data-placeholder', _t(__CLASS__ . '.ADDGROUP', 'Add groups'))
->setDescription(_t(__CLASS__ . '.OWNERGROUPSDESCRIPTION', 'Page owners that are responsible for reviews'));

$fields->addFieldToTab('Root.ContentReview', $groupField);

// Email content
$fields->addFieldsToTab(
'Root.ContentReview',
array(
TextField::create('ReviewFrom', _t('ContentReview.EMAILFROM', 'From email address'))
->setDescription(_t('Review.EMAILFROM_RIGHTTITLE', 'e.g: [email protected]')),
TextField::create('ReviewSubject', _t('ContentReview.EMAILSUBJECT', 'Subject line')),
TextAreaField::create('ReviewBody', _t('ContentReview.EMAILTEMPLATE', 'Email template')),
TextField::create('ReviewFrom', _t(__CLASS__ . '.EMAILFROM', 'From email address'))
->setDescription(_t(__CLASS__ . '.EMAILFROM_RIGHTTITLE', 'e.g: [email protected]')),
TextField::create('ReviewSubject', _t(__CLASS__ . '.EMAILSUBJECT', 'Subject line')),
TextAreaField::create('ReviewBody', _t(__CLASS__ . '.EMAILTEMPLATE', 'Email template')),
LiteralField::create(
'TemplateHelp',
$this->owner->renderWith('SilverStripe\\ContentReview\\ContentReviewAdminHelp')
Expand Down
44 changes: 22 additions & 22 deletions src/Extensions/SiteTreeContentReview.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,13 @@ public function updateSettingsFields(FieldList $fields)
// Display read-only version only
if (!Permission::check("EDIT_CONTENT_REVIEW_FIELDS")) {
$schedule = self::get_schedule();
$contentOwners = ReadonlyField::create("ROContentOwners", _t("ContentReview.CONTENTOWNERS", "Content Owners"), $this->getOwnerNames());
$nextReviewAt = DateField::create('RONextReviewDate', _t("ContentReview.NEXTREVIEWDATE", "Next review date"), $this->owner->NextReviewDate);
$contentOwners = ReadonlyField::create("ROContentOwners", _t(__CLASS__ . ".CONTENTOWNERS", "Content Owners"), $this->getOwnerNames());
$nextReviewAt = DateField::create('RONextReviewDate', _t(__CLASS__ . ".NEXTREVIEWDATE", "Next review date"), $this->owner->NextReviewDate);

if (!isset($schedule[$this->owner->ReviewPeriodDays])) {
$reviewFreq = ReadonlyField::create("ROReviewPeriodDays", _t("ContentReview.REVIEWFREQUENCY", "Review frequency"), $schedule[0]);
$reviewFreq = ReadonlyField::create("ROReviewPeriodDays", _t(__CLASS__ . ".REVIEWFREQUENCY", "Review frequency"), $schedule[0]);
} else {
$reviewFreq = ReadonlyField::create("ROReviewPeriodDays", _t("ContentReview.REVIEWFREQUENCY", "Review frequency"), $schedule[$this->owner->ReviewPeriodDays]);
$reviewFreq = ReadonlyField::create("ROReviewPeriodDays", _t(__CLASS__ . ".REVIEWFREQUENCY", "Review frequency"), $schedule[$this->owner->ReviewPeriodDays]);
}

$logConfig = GridFieldConfig::create()
Expand All @@ -359,7 +359,7 @@ public function updateSettingsFields(FieldList $fields)
$logs = GridField::create("ROReviewNotes", "Review Notes", $this->owner->ReviewLogs(), $logConfig);


$optionsFrom = ReadonlyField::create("ROType", _t("ContentReview.SETTINGSFROM", "Options are"), $this->owner->ContentReviewType);
$optionsFrom = ReadonlyField::create("ROType", _t(__CLASS__ . ".SETTINGSFROM", "Options are"), $this->owner->ContentReviewType);

$fields->addFieldsToTab("Root.ContentReview", array(
$contentOwners,
Expand All @@ -373,22 +373,22 @@ public function updateSettingsFields(FieldList $fields)
}

$options = array();
$options["Disabled"] = _t("ContentReview.DISABLE", "Disable content review");
$options["Inherit"] = _t("ContentReview.INHERIT", "Inherit from parent page");
$options["Custom"] = _t("ContentReview.CUSTOM", "Custom settings");
$options["Disabled"] = _t(__CLASS__ . ".DISABLE", "Disable content review");
$options["Inherit"] = _t(__CLASS__ . ".INHERIT", "Inherit from parent page");
$options["Custom"] = _t(__CLASS__ . ".CUSTOM", "Custom settings");

$viewersOptionsField = OptionsetField::create("ContentReviewType", _t("ContentReview.OPTIONS", "Options"), $options);
$viewersOptionsField = OptionsetField::create("ContentReviewType", _t(__CLASS__ . ".OPTIONS", "Options"), $options);

$users = Permission::get_members_by_permission(array("CMS_ACCESS_CMSMain", "ADMIN"));

$usersMap = $users->map("ID", "Title")->toArray();

asort($usersMap);

$userField = ListboxField::create("OwnerUsers", _t("ContentReview.PAGEOWNERUSERS", "Users"), $usersMap)
$userField = ListboxField::create("OwnerUsers", _t(__CLASS__ . ".PAGEOWNERUSERS", "Users"), $usersMap)
->addExtraClass('custom-setting')
->setAttribute("data-placeholder", _t("ContentReview.ADDUSERS", "Add users"))
->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));
->setAttribute("data-placeholder", _t(__CLASS__ . ".ADDUSERS", "Add users"))
->setDescription(_t(__CLASS__ . '.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));

$groupsMap = array();

Expand All @@ -397,34 +397,34 @@ public function updateSettingsFields(FieldList $fields)
}
asort($groupsMap);

$groupField = ListboxField::create("OwnerGroups", _t("ContentReview.PAGEOWNERGROUPS", "Groups"), $groupsMap)
$groupField = ListboxField::create("OwnerGroups", _t(__CLASS__ . ".PAGEOWNERGROUPS", "Groups"), $groupsMap)
->addExtraClass('custom-setting')
->setAttribute("data-placeholder", _t("ContentReview.ADDGROUP", "Add groups"))
->setDescription(_t("ContentReview.OWNERGROUPSDESCRIPTION", "Page owners that are responsible for reviews"));
->setAttribute("data-placeholder", _t(__CLASS__ . ".ADDGROUP", "Add groups"))
->setDescription(_t(__CLASS__ . ".OWNERGROUPSDESCRIPTION", "Page owners that are responsible for reviews"));

$reviewDate = DateField::create("NextReviewDate", _t("ContentReview.NEXTREVIEWDATE", "Next review date"))
->setDescription(_t("ContentReview.NEXTREVIEWDATADESCRIPTION", "Leave blank for no review"));
$reviewDate = DateField::create("NextReviewDate", _t(__CLASS__ . ".NEXTREVIEWDATE", "Next review date"))
->setDescription(_t(__CLASS__ . ".NEXTREVIEWDATADESCRIPTION", "Leave blank for no review"));

$reviewFrequency = DropdownField::create(
"ReviewPeriodDays",
_t("ContentReview.REVIEWFREQUENCY", "Review frequency"),
_t(__CLASS__ . ".REVIEWFREQUENCY", "Review frequency"),
self::get_schedule()
)
->addExtraClass('custom-setting')
->setDescription(_t("ContentReview.REVIEWFREQUENCYDESCRIPTION", "The review date will be set to this far in the future whenever the page is published"));
->setDescription(_t(__CLASS__ . ".REVIEWFREQUENCYDESCRIPTION", "The review date will be set to this far in the future whenever the page is published"));

$notesField = GridField::create("ReviewNotes", "Review Notes", $this->owner->ReviewLogs(), GridFieldConfig_RecordEditor::create());

$fields->addFieldsToTab("Root.ContentReview", array(
HeaderField::create('ContentReviewHeader', _t("ContentReview.REVIEWHEADER", "Content review"), 2),
HeaderField::create('ContentReviewHeader', _t(__CLASS__ . ".REVIEWHEADER", "Content review"), 2),
$viewersOptionsField,
CompositeField::create(
$userField,
$groupField,
$reviewDate,
$reviewFrequency
)->addExtraClass("review-settings"),
ReadonlyField::create("ROContentOwners", _t("ContentReview.CONTENTOWNERS", "Content Owners"), $this->getOwnerNames()),
ReadonlyField::create("ROContentOwners", _t(__CLASS__ . ".CONTENTOWNERS", "Content Owners"), $this->getOwnerNames()),
$notesField,
));
}
Expand Down Expand Up @@ -618,7 +618,7 @@ public function providePermissions()
return array(
"EDIT_CONTENT_REVIEW_FIELDS" => array(
"name" => "Set content owners and review dates",
"category" => _t("Permissions.CONTENT_CATEGORY", "Content permissions"),
"category" => _t("SilverStripe\\Security\\Permission.CONTENT_CATEGORY", "Content permissions"),
"sort" => 50,
),
);
Expand Down
10 changes: 5 additions & 5 deletions src/Reports/PagesDueForReviewReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PagesDueForReviewReport extends Report
*/
public function title()
{
return _t("PagesDueForReviewReport.TITLE", "Pages due for review");
return _t(__CLASS__ . ".TITLE", "Pages due for review");
}

/**
Expand All @@ -43,29 +43,29 @@ public function parameterFields()
$filtersList->push(
DateField::create(
"ReviewDateAfter",
_t("PagesDueForReviewReport.REVIEWDATEAFTER", "Review date after or on")
_t(__CLASS__ . ".REVIEWDATEAFTER", "Review date after or on")
)
);

$filtersList->push(
DateField::create(
"ReviewDateBefore",
_t("PagesDueForReviewReport.REVIEWDATEBEFORE", "Review date before or on"),
_t(__CLASS__ . ".REVIEWDATEBEFORE", "Review date before or on"),
date("d/m/Y", strtotime("midnight"))
)
);

$filtersList->push(
CheckboxField::create(
"ShowVirtualPages",
_t("PagesDueForReviewReport.SHOWVIRTUALPAGES", "Show Virtual Pages")
_t(__CLASS__ . ".SHOWVIRTUALPAGES", "Show Virtual Pages")
)
);

$filtersList->push(
CheckboxField::create(
"OnlyMyPages",
_t("PagesDueForReviewReport.ONLYMYPAGES", "Only Show pages assigned to me")
_t(__CLASS__ . ".ONLYMYPAGES", "Only Show pages assigned to me")
)
);

Expand Down
2 changes: 1 addition & 1 deletion src/Reports/PagesWithoutReviewScheduleReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PagesWithoutReviewScheduleReport extends Report
*/
public function title()
{
return _t("PagesWithoutReviewScheduleReport.TITLE", "Pages without a scheduled review.");
return _t(__CLASS__ . ".TITLE", "Pages without a scheduled review.");
}

/**
Expand Down
4 changes: 2 additions & 2 deletions templates/SilverStripe/ContentReview/ContentReviewEmail.ss
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<% loop $Pages %>
<tr>
<td valign="top">$Title</td>
<td><a href="{$BaseURL}admin/pages/edit/show/$ID"><%t ContentReviewEmails.REVIEWPAGELINK 'Review the page in the CMS' %></a><br />
<a href="$AbsoluteLink"><%t ContentReviewEmails.VIEWPUBLISHEDLINK 'View this page on the website' %></a>
<td><a href="{$BaseURL}admin/pages/edit/show/$ID"><%t SilverStripe\\ContentReview\\Tasks\\ContentReviewEmails.REVIEWPAGELINK 'Review the page in the CMS' %></a><br />
<a href="$AbsoluteLink"><%t SilverStripe\\ContentReview\\Tasks\\ContentReviewEmails.VIEWPUBLISHEDLINK 'View this page on the website' %></a>
</td>
</tr>
<% end_loop %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="content-review__button-holder">
<a href="#" class="content-review__button"><%t ContentReview.CONTENTREVIEW 'Content due for review' %></a>
<a href="#" class="content-review__button"><%t SilverStripe\\ContentReview\\Extensions\\SiteTreeContentReview.CONTENTREVIEW 'Content due for review' %></a>
</div>

0 comments on commit edef740

Please sign in to comment.