diff --git a/code/SubsiteReportWrapper.php b/code/SubsiteReportWrapper.php index a229e19..2774cfc 100644 --- a/code/SubsiteReportWrapper.php +++ b/code/SubsiteReportWrapper.php @@ -12,7 +12,11 @@ class SubsiteReportWrapper extends SS_ReportWrapper { $subsites = Subsite::accessible_sites('CMS_ACCESS_CMSMain', true); $options = $subsites->toDropdownMap('ID', 'Title'); - $subsiteField = new TreeMultiselectField('Subsites', 'Sites', $options); + $subsiteField = new TreeMultiselectField( + 'Subsites', + _t('SubsiteReportWrapper.ReportDropdown', 'Sites'), + $options + ); $subsiteField->setValue(array_keys($options)); // We don't need to make the field editable if only one subsite is available diff --git a/code/SubsitesVirtualPage.php b/code/SubsitesVirtualPage.php index 5d78a3b..5d8831c 100644 --- a/code/SubsitesVirtualPage.php +++ b/code/SubsitesVirtualPage.php @@ -24,7 +24,7 @@ class SubsitesVirtualPage extends VirtualPage { $subsiteSelectionField = new DropdownField( "CopyContentFromID_SubsiteID", - "Subsite", + _t('SubsitesVirtualPage.SubsiteField',"Subsite"), $subsites->map('ID', 'Title'), ($this->CopyContentFromID) ? $this->CopyContentFrom()->SubsiteID : Session::get('SubsiteID') ); @@ -66,13 +66,51 @@ class SubsitesVirtualPage extends VirtualPage { } - $fields->addFieldToTab('Root.Main', new TextField('CustomMetaTitle', 'Title (overrides inherited value from the source)'), 'MetaTitle'); - $fields->addFieldToTab('Root.Main', new TextareaField('CustomMetaKeywords', 'Keywords (overrides inherited value from the source)'), 'MetaKeywords'); - $fields->addFieldToTab('Root.Main', new TextareaField('CustomMetaDescription', 'Description (overrides inherited value from the source)'), 'MetaDescription'); - $fields->addFieldToTab('Root.Main', new TextField('CustomExtraMeta', 'Custom Meta Tags (overrides inherited value from the source)'), 'ExtraMeta'); + $fields->addFieldToTab( + 'Root.Main', + TextField::create( + 'CustomMetaTitle', + $this->fieldLabel('CustomMetaTitle') + )->setDescription(_t('SubsitesVirtualPage.OverrideNote', 'Overrides inherited value from the source')), + 'MetaTitle' + ); + $fields->addFieldToTab( + 'Root.Main', + TextareaField::create( + 'CustomMetaKeywords', + $this->fieldLabel('CustomMetaTitle') + )->setDescription(_t('SubsitesVirtualPage.OverrideNote')), + 'MetaKeywords' + ); + $fields->addFieldToTab( + 'Root.Main', + TextareaField::create( + 'CustomMetaDescription', + $this->fieldLabel('CustomMetaTitle') + )->setDescription(_t('SubsitesVirtualPage.OverrideNote')), + 'MetaDescription' + ); + $fields->addFieldToTab( + 'Root.Main', + TextField::create( + 'CustomExtraMeta', + $this->fieldLabel('CustomMetaTitle') + )->setDescription(_t('SubsitesVirtualPage.OverrideNote')), + 'ExtraMeta' + ); return $fields; } + + public function fieldLabels($includerelations = true) { + $labels = parent::fieldLabels($includerelations); + $labels['CustomMetaTitle'] = _t('Subsite.CustomMetaTitle','Title'); + $labels['CustomMetaKeywords'] = _t('Subsite.CustomMetaKeywords','Keywords'); + $labels['CustomMetaDescription'] = _t('Subsite.CustomMetaDescription','Description'); + $labels['CustomExtraMeta'] = _t('Subsite.CustomExtraMeta','Custom Meta Tags'); + + return $labels; + } public function getVirtualFields() { $fields = parent::getVirtualFields(); diff --git a/code/extensions/FileSubsites.php b/code/extensions/FileSubsites.php index 85e0d26..0c5a438 100644 --- a/code/extensions/FileSubsites.php +++ b/code/extensions/FileSubsites.php @@ -30,21 +30,26 @@ class FileSubsites extends DataExtension { if($this->owner instanceof Folder) { $sites = Subsite::accessible_sites('CMS_ACCESS_AssetAdmin'); $values = array(); - $values[0] = 'All sites'; + $values[0] = _t('FileSubsites.AllSitesDropdownOpt','All sites'); foreach ($sites as $site) { $values[$site->ID] = $site->Title; } ksort($values); if($sites){ //Dropdown needed to move folders between subsites - $fields->push($dropdown = new DropdownField('SubsiteID', 'Subsite', $values)); + $dropdown = new DropdownField( + 'SubsiteID', + _t('FileSubsites.SubsiteFieldLabel','Subsite'), + $values + ); + $dropdown->addExtraClass('subsites-move-dropdown'); + $fields->push($dropdown); $fields->push(new LiteralField( 'Message', '
' )); - $dropdown->addExtraClass('subsites-move-dropdown'); } } } diff --git a/code/extensions/GroupSubsites.php b/code/extensions/GroupSubsites.php index fcadc1f..a852742 100644 --- a/code/extensions/GroupSubsites.php +++ b/code/extensions/GroupSubsites.php @@ -93,7 +93,8 @@ class GroupSubsites extends DataExtension implements PermissionProvider { */ function alternateTreeTitle() { if($this->owner->AccessAllSubsites) { - return htmlspecialchars($this->owner->Title, ENT_QUOTES) . ' (global group)'; + $title = _t('GroupSubsites.GlobalGroup', 'global group'); + return htmlspecialchars($this->owner->Title, ENT_QUOTES) . ' (' . $title . ')'; } else { $subsites = Convert::raw2xml(implode(", ", $this->owner->Subsites()->column('Title'))); return htmlspecialchars($this->owner->Title) . " ($subsites)"; diff --git a/code/extensions/LeftAndMainSubsites.php b/code/extensions/LeftAndMainSubsites.php index ee50f76..acf503f 100644 --- a/code/extensions/LeftAndMainSubsites.php +++ b/code/extensions/LeftAndMainSubsites.php @@ -40,6 +40,10 @@ class LeftAndMainSubsites extends Extension { * @return ArrayList of {@link Subsite} instances. */ function sectionSites($includeMainSite = true, $mainSiteTitle = "Main site", $member = null) { + if($mainSiteTitle == 'Main site') { + $mainSiteTitle = _t('Subsites.MainSiteTitle', 'Main site'); + } + // Rationalise member arguments if(!$member) $member = Member::currentUser(); if(!$member) return new ArrayList(); diff --git a/code/extensions/SiteTreeSubsites.php b/code/extensions/SiteTreeSubsites.php index ac3e96e..a1cda6e 100644 --- a/code/extensions/SiteTreeSubsites.php +++ b/code/extensions/SiteTreeSubsites.php @@ -112,8 +112,8 @@ class SiteTreeSubsites extends DataExtension { if(!$sc) { $sc = new SiteConfig(); $sc->SubsiteID = $this->owner->SubsiteID; - $sc->Title = 'Your Site Name'; - $sc->Tagline = 'your tagline here'; + $sc->Title = _t('Subsite.SiteConfigTitle','Your Site Name'); + $sc->Tagline = _t('Subsite.SiteConfigSubtitle','Your tagline here'); $sc->write(); } return $sc; diff --git a/code/model/Subsite.php b/code/model/Subsite.php index 6f3a92d..7eb1e74 100644 --- a/code/model/Subsite.php +++ b/code/model/Subsite.php @@ -63,23 +63,11 @@ class Subsite extends DataObject implements PermissionProvider { ); private static $searchable_fields = array( - 'Title' => array( - 'title' => 'Subsite Name' - ), - 'Domains.Domain' => array( - 'title' => 'Domain name' - ), - 'IsPublic' => array( - 'title' => 'Active subsite', - ), + 'Title', + 'Domains.Domain', + 'IsPublic', ); - private static $summary_fields = array( - 'Title' => 'Subsite Name', - 'PrimaryDomain' => 'Primary Domain', - 'IsPublic' => 'Active subsite', - ); - /** * Memory cache of accessible sites */ @@ -204,12 +192,24 @@ class Subsite extends DataObject implements PermissionProvider { */ function getCMSFields() { if($this->ID!=0) { - $domainTable = new GridField("Domains", "Domains", $this->Domains(), GridFieldConfig_RecordEditor::create(10)); + $domainTable = new GridField( + "Domains", + _t('Subsite.DomainsListTitle',"Domains"), + $this->Domains(), + GridFieldConfig_RecordEditor::create(10) + ); }else { - $domainTable = new LiteralField('Domains', ''._t('Subsite.DOMAINSAVEFIRST', 'You can only add domains after saving for the first time').'
'); + $domainTable = new LiteralField( + 'Domains', + ''._t('Subsite.DOMAINSAVEFIRST', 'You can only add domains after saving for the first time').'
' + ); } - $languageSelector = new DropdownField('Language', 'Language', i18n::get_common_locales()); + $languageSelector = new DropdownField( + 'Language', + $this->fieldLabel('Language'), + i18n::get_common_locales() + ); $pageTypeMap = array(); $pageTypes = SiteTree::page_type_classes(); @@ -220,18 +220,22 @@ class Subsite extends DataObject implements PermissionProvider { $fields = new FieldList( $subsiteTabs = new TabSet('Root', - new Tab('Configuration', + new Tab( + 'Configuration', + _t('Subsite.TabTitleConfig', 'Configuration'), new HeaderField($this->getClassName() . ' configuration', 2), - new TextField('Title', 'Name of subsite:', $this->Title), + new TextField('Title', $this->fieldLabel('Title'), $this->Title), - new HeaderField("Domains for this subsite"), + new HeaderField( + _t('Subsite.DomainsHeadline',"Domains for this subsite") + ), $domainTable, $languageSelector, // new TextField('RedirectURL', 'Redirect to URL', $this->RedirectURL), - new CheckboxField('DefaultSite', 'Default site', $this->DefaultSite), - new CheckboxField('IsPublic', 'Enable public access', $this->IsPublic), + new CheckboxField('DefaultSite', $this->fieldLabel('DefaultSite'), $this->DefaultSite), + new CheckboxField('IsPublic', $this->fieldLabel('IsPublic'), $this->IsPublic), - new DropdownField('Theme','Theme', $this->allowedThemes(), $this->Theme), + new DropdownField('Theme',$this->fieldLabel('Theme'), $this->allowedThemes(), $this->Theme), new LiteralField( @@ -258,6 +262,29 @@ class Subsite extends DataObject implements PermissionProvider { return $fields; } + public function fieldLabels($includerelations = true) { + $labels = parent::fieldLabels($includerelations); + $labels['Title'] = _t('Subsites.TitleFieldLabel', 'Subsite Name'); + $labels['RedirectURL'] = _t('Subsites.RedirectURLFieldLabel', 'Redirect URL'); + $labels['DefaultSite'] = _t('Subsites.DefaultSiteFieldLabel', 'Default site'); + $labels['Theme'] = _t('Subsites.ThemeFieldLabel', 'Theme'); + $labels['Language'] = _t('Subsites.LanguageFieldLabel', 'Language'); + $labels['IsPublic'] = _t('Subsites.IsPublicFieldLabel', 'Enable public access'); + $labels['PageTypeBlacklist'] = _t('Subsites.PageTypeBlacklistFieldLabel', 'Page Type Blacklist'); + $labels['Domains.Domain'] = _t('Subsites.DomainFieldLabel', 'Domain'); + $labels['PrimaryDomain'] = _t('Subsites.PrimaryDomainFieldLabel', 'Primary Domain'); + + return $labels; + } + + public function summaryFields() { + return array( + 'Title' => $this->fieldLabel('Title'), + 'PrimaryDomain' => $this->fieldLabel('PrimaryDomain'), + 'IsPublic' => _t('Subsite.IsPublicHeaderField','Active subsite'), + ); + } + /** * @todo getClassName is redundant, already stored as a database field? */ @@ -267,15 +294,25 @@ class Subsite extends DataObject implements PermissionProvider { function getCMSActions() { return new FieldList( - new FormAction('callPageMethod', "Create copy", null, 'adminDuplicate') + new FormAction( + 'callPageMethod', + _t('Subsite.ButtonLabelCopy',"Create copy"), + null, + 'adminDuplicate' + ) ); } function adminDuplicate() { $newItem = $this->duplicate(); - $JS_title = Convert::raw2js($this->Title); + $message = _t( + 'Subsite.CopyMessage', + 'Created a copy of {title}', + array('title' => Convert::raw2js($this->Title)) + ); + return <<