Having some insanely frustrating issues with the i18n _t() stuff in silverstripe. (Im sure i had this working but now its not).
I currently have a php contact form that I need to translate to french. here is a snippet of my code from the php page. Editing the second argument shows changes in the displayed text, it just never seems to find the translation
public function generalContactForm() {
$fields = new FieldList(
new TextField('FirstName', '', _t('ContactUs.FirstName','FIRST NAME')),
new TextField('Surname', '', _t('ContactUs.Surname','Surname')),
new EmailField('Email', '', 'Email'),
new TextField('Phone', '', _t('ContactUs.Phone' ,'Phone No.')),
new TextField('Country', '', _t('ContactUs.Country','Country Of Origin')),
new TextareaField('Message', '', _t('ContactUs.Comments','COMMENTS'))
);
$actions = new FieldList(
new FormAction('submitGeneralForm', _t('Main.Submit','Submit'))
);
return new Form($this, 'generalContactForm', $fields, $actions);
}
Then I have my fr.yml in mysite/lang/fr.yml.(I have also tried fr_FR.yml as well).I have verified the integrity of the yaml file with an online validator and all good.
fr:
Main:
Submit: 'Submit TBT'
ContactUs:
FirstName: 'Prenom'
Surname: 'Surname TBT'
Phone: 'Phone TBT'
Country: 'Country TBT'
Comments: 'Comments TBT'
Response: 'Canned Response TBT'
Company: 'Company TBT'
Position: 'Position TBT'
Website: 'Website TBT'
Minimum: 'Minimin TBT'
Maximum: 'Maximum TBT'
I have tried copying the lang folder to pretty much every imaginable location within the site structure including themes/name/lang and no luck as well as ensuring doing a flush=all after every move. Please help!