Trying to get translations to work in widget. But get not the translation
Directory structure of the widget in the ss root is:
- widget_test
-- _config
--- TestWidget.yml
-- code
--- extension
---- TestWidgetExtension.php
--- model
---- TestWidget.php
-- lang
--- _manifest_exclude
--- de.yml
--- en.yml
-- templates
-- _config.php
-----------------------------------------------------------------------
_config.php:
<?php /* */ ?>
-----------------------------------------------------------------------
Example code of TestWidget.php:
function getCMSFields()
{
$fields = new FieldList(
new TabSet("GeneralTab",
$tabTemplate = new Tab(
$name = 'SubTab',
new HeaderField("filters", _t('FormFieldLabels.FILTERS', 'Filters')),
new HeaderField("sorting", _t('FormFieldLabels.SORTING', 'Sorting'))
),
$tabRequest = new Tab(
$name = 'RequestSettings'
),
$tabInfo = new Tab(
$name = 'InfoTab'
)
)
);
$tabTemplate->setTitle(_t('TabLabels.TEMPLATESETTINGS', "Template settings"));
$tabRequest->setTitle(_t('TabLabels.REQUESTSETTINGS', "Request settings"));
$tabInfo->setTitle(_t('TabLabels.INFOTAB', "Details"));
$this->extend('updateCMSFields', $fields);
return $fields;
}
-----------------------------------------------------------------------
Example code of TestWidgetExtension.php:
function updateCMSFields(FieldList $fields)
{
// Template settings
// - Filters
$fields->addFieldToTab('GeneralTab.SubTab', new NumericField("ResultStart", _t('FormFieldLabels.STARTROW', "STARTROW")), "sorting");
}
-----------------------------------------------------------------------
Example code of de.yml:
de:
FormFieldLabels:
STARTROW: "Start at ..."
-----------------------------------------------------------------------
The NumericField is rendered, but the label is "STARTROW", instead it should be "Start at ..." Another problem is, that the values of the formfields don´t find their way to the database, but I already posted this in another topic (http://www.silverstripe.org/widgets-2/show/23444)
Any idea could help!