FIX strings instead of __CLASS__ for translation keys in trait (#1101)

* strings instead of __CLASS__ for translation keys in trait

* use double backslashes for FQN in _t()

* amend missing for double backslashes for FQN in _t()
This commit is contained in:
Lukas 2022-03-16 02:48:41 +01:00 committed by GitHub
parent 6826489295
commit a97fb570c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -183,16 +183,16 @@ trait UserForm
$fields->removeByName('EmailRecipients'); $fields->removeByName('EmailRecipients');
// define tabs // define tabs
$fields->findOrMakeTab('Root.FormOptions', _t(__CLASS__.'.CONFIGURATION', 'Configuration')); $fields->findOrMakeTab('Root.FormOptions', _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.CONFIGURATION', 'Configuration'));
$fields->findOrMakeTab('Root.Recipients', _t(__CLASS__.'.RECIPIENTS', 'Recipients')); $fields->findOrMakeTab('Root.Recipients', _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.RECIPIENTS', 'Recipients'));
$fields->findOrMakeTab('Root.Submissions', _t(__CLASS__.'.SUBMISSIONS', 'Submissions')); $fields->findOrMakeTab('Root.Submissions', _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.SUBMISSIONS', 'Submissions'));
// text to show on complete // text to show on complete
$onCompleteFieldSet = CompositeField::create( $onCompleteFieldSet = CompositeField::create(
$label = LabelField::create( $label = LabelField::create(
'OnCompleteMessageLabel', 'OnCompleteMessageLabel',
_t(__CLASS__.'.ONCOMPLETELABEL', 'Show on completion') _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.ONCOMPLETELABEL', 'Show on completion')
), ),
$editor = HTMLEditorField::create( $editor = HTMLEditorField::create(
'OnCompleteMessage', 'OnCompleteMessage',
@ -210,7 +210,7 @@ trait UserForm
$emailRecipientsConfig = GridFieldConfig_RecordEditor::create(10); $emailRecipientsConfig = GridFieldConfig_RecordEditor::create(10);
$emailRecipientsConfig->getComponentByType(GridFieldAddNewButton::class) $emailRecipientsConfig->getComponentByType(GridFieldAddNewButton::class)
->setButtonName( ->setButtonName(
_t(__CLASS__.'.ADDEMAILRECIPIENT', 'Add Email Recipient') _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.ADDEMAILRECIPIENT', 'Add Email Recipient')
); );
// who do we email on submission // who do we email on submission
@ -315,7 +315,7 @@ SQL;
'Root.FormOptions', 'Root.FormOptions',
CheckboxField::create( CheckboxField::create(
'DisableSaveSubmissions', 'DisableSaveSubmissions',
_t(__CLASS__.'.SAVESUBMISSIONS', 'Disable Saving Submissions to Server') _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.SAVESUBMISSIONS', 'Disable Saving Submissions to Server')
) )
); );
}); });
@ -326,7 +326,7 @@ SQL;
$fields->addFieldToTab('Root.Main', LiteralField::create( $fields->addFieldToTab('Root.Main', LiteralField::create(
'EmailRecipientsWarning', 'EmailRecipientsWarning',
'<p class="alert alert-warning">' . _t( '<p class="alert alert-warning">' . _t(
__CLASS__.'.NORECIPIENTS', 'SilverStripe\\UserForms\\Model\\UserDefinedForm.NORECIPIENTS',
'Warning: You have not configured any recipients. Form submissions may be missed.' 'Warning: You have not configured any recipients. Form submissions may be missed.'
) )
. '</p>' . '</p>'
@ -367,17 +367,17 @@ SQL;
*/ */
public function getFormOptions() public function getFormOptions()
{ {
$submit = ($this->SubmitButtonText) ? $this->SubmitButtonText : _t(__CLASS__.'.SUBMITBUTTON', 'Submit'); $submit = ($this->SubmitButtonText) ? $this->SubmitButtonText : _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.SUBMITBUTTON', 'Submit');
$clear = ($this->ClearButtonText) ? $this->ClearButtonText : _t(__CLASS__.'.CLEARBUTTON', 'Clear'); $clear = ($this->ClearButtonText) ? $this->ClearButtonText : _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.CLEARBUTTON', 'Clear');
$options = FieldList::create( $options = FieldList::create(
TextField::create('SubmitButtonText', _t(__CLASS__.'.TEXTONSUBMIT', 'Text on submit button:'), $submit), TextField::create('SubmitButtonText', _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.TEXTONSUBMIT', 'Text on submit button:'), $submit),
TextField::create('ClearButtonText', _t(__CLASS__.'.TEXTONCLEAR', 'Text on clear button:'), $clear), TextField::create('ClearButtonText', _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.TEXTONCLEAR', 'Text on clear button:'), $clear),
CheckboxField::create('ShowClearButton', _t(__CLASS__.'.SHOWCLEARFORM', 'Show Clear Form Button'), $this->ShowClearButton), CheckboxField::create('ShowClearButton', _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.SHOWCLEARFORM', 'Show Clear Form Button'), $this->ShowClearButton),
CheckboxField::create('EnableLiveValidation', _t(__CLASS__.'.ENABLELIVEVALIDATION', 'Enable live validation')), CheckboxField::create('EnableLiveValidation', _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.ENABLELIVEVALIDATION', 'Enable live validation')),
CheckboxField::create('DisplayErrorMessagesAtTop', _t(__CLASS__.'.DISPLAYERRORMESSAGESATTOP', 'Display error messages above the form?')), CheckboxField::create('DisplayErrorMessagesAtTop', _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.DISPLAYERRORMESSAGESATTOP', 'Display error messages above the form?')),
CheckboxField::create('DisableCsrfSecurityToken', _t(__CLASS__.'.DISABLECSRFSECURITYTOKEN', 'Disable CSRF Token')), CheckboxField::create('DisableCsrfSecurityToken', _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.DISABLECSRFSECURITYTOKEN', 'Disable CSRF Token')),
CheckboxField::create('DisableAuthenicatedFinishAction', _t(__CLASS__.'.DISABLEAUTHENICATEDFINISHACTION', 'Disable Authentication on finish action')) CheckboxField::create('DisableAuthenicatedFinishAction', _t('SilverStripe\\UserForms\\Model\\UserDefinedForm.DISABLEAUTHENICATEDFINISHACTION', 'Disable Authentication on finish action'))
); );
$this->extend('updateFormOptions', $options); $this->extend('updateFormOptions', $options);