FIX Add translation to some areas of EditableFormField that were missing them (#568)

This commit recreates https://github.com/silverstripe/silverstripe-userforms/pull/386 from
@rasstislav.
This commit is contained in:
Robbie Averill 2017-04-11 08:15:29 +12:00 committed by Damian Mooyman
parent d16692d9c1
commit 2e73787088
2 changed files with 15 additions and 6 deletions

View File

@ -167,22 +167,23 @@ class EditableFormField extends DataObject
_t( _t(
'EditableFormField.MERGEFIELDNAME', 'EditableFormField.MERGEFIELDNAME',
'<div class="field readonly">' . '<div class="field readonly">' .
'<label class="left">Merge field</label>' . '<label class="left">' . _t('EditableFormField.MERGEFIELDNAME', 'Merge field') . '</label>' .
'<div class="middleColumn">' . '<div class="middleColumn">' .
'<span class="readonly">$' . $this->Name . '</span>' . '<span class="readonly">$' . $this->Name . '</span>' .
'</div>' . '</div>' .
'</div>' '</div>'
) )
), ),
TextField::create('Title'), TextField::create('Title', _t('EditableFormField.TITLE', 'Title')),
TextField::create('Default', _t('EditableFormField.DEFAULT', 'Default value')), TextField::create('Default', _t('EditableFormField.DEFAULT', 'Default value')),
TextField::create('RightTitle', _t('EditableFormField.RIGHTTITLE', 'Right title')), TextField::create('RightTitle', _t('EditableFormField.RIGHTTITLE', 'Right title')),
SegmentField::create('Name')->setModifiers(array( SegmentField::create('Name', _t('EditableFormField.NAME', 'Name'))->setModifiers(array(
UnderscoreSegmentFieldModifier::create()->setDefault('FieldName'), UnderscoreSegmentFieldModifier::create()->setDefault('FieldName'),
DisambiguationSegmentFieldModifier::create(), DisambiguationSegmentFieldModifier::create(),
))->setPreview($this->Name) ))->setPreview($this->Name)
) )
); );
$fields->fieldByName('Root.Main')->setTitle(_t('SiteTree.TABMAIN', 'Main'));
// Custom settings // Custom settings
if (!empty(self::$allowed_css)) { if (!empty(self::$allowed_css)) {
@ -221,6 +222,7 @@ class EditableFormField extends DataObject
$validationFields = $this->getFieldValidationOptions(); $validationFields = $this->getFieldValidationOptions();
if ($validationFields && $validationFields->count()) { if ($validationFields && $validationFields->count()) {
$fields->addFieldsToTab('Root.Validation', $validationFields); $fields->addFieldsToTab('Root.Validation', $validationFields);
$fields->fieldByName('Root.Validation')->setTitle(_t('EditableFormField.VALIDATION', 'Validation'));
} }
// Add display rule fields // Add display rule fields
@ -294,11 +296,15 @@ class EditableFormField extends DataObject
); );
return new FieldList( return new FieldList(
CheckboxField::create('ShowOnLoad') CheckboxField::create(
->setDescription(_t( 'ShowOnLoad',
_t('EditableFormField.SHOWONLOAD_TITLE', 'Show on load')
)->setDescription(
_t(
'EditableFormField.SHOWONLOAD', 'EditableFormField.SHOWONLOAD',
'Initial visibility before processing these rules' 'Initial visibility before processing these rules'
)), )
),
GridField::create( GridField::create(
'DisplayRules', 'DisplayRules',
_t('EditableFormField.CUSTOMRULES', 'Custom Rules'), _t('EditableFormField.CUSTOMRULES', 'Custom Rules'),

View File

@ -78,8 +78,10 @@ en:
LESSTHANEQUAL: 'Value Less Than Or Equal' LESSTHANEQUAL: 'Value Less Than Or Equal'
LOCKED: 'These fields cannot be modified' LOCKED: 'These fields cannot be modified'
MAXVALUE: 'Max Value' MAXVALUE: 'Max Value'
MERGEFIELDNAME: 'Merge field'
MINVALUE: 'Min Value' MINVALUE: 'Min Value'
'NO': 'No' 'NO': 'No'
NAME: 'Name'
NOTBLANK: 'Not Blank' NOTBLANK: 'Not Blank'
NOTVALUE: 'Not Value' NOTVALUE: 'Not Value'
OPTIONS: Options OPTIONS: Options
@ -89,6 +91,7 @@ en:
RIGHTTITLE: 'Right title' RIGHTTITLE: 'Right title'
SHOW: Show SHOW: Show
SHOWONLOAD: 'Initial visibility before processing these rules' SHOWONLOAD: 'Initial visibility before processing these rules'
SHOWONLOAD_TITLE: 'Show on load'
SHOWOPTIONS: 'Show Options' SHOWOPTIONS: 'Show Options'
SHOWTHISFIELD: 'Show This Field' SHOWTHISFIELD: 'Show This Field'
SINGULARNAME: 'Editable Form Field' SINGULARNAME: 'Editable Form Field'