I'm setting up an SS project and want to add url based locales (/en, /gb, etc) using the silverstripe-fluent addon (https://github.com/tractorcow-farm/silverstripe-fluent). I've successfully installed it and can add locales using cms but the translatable fields only work for main content. How do i make other widgets and dataobjects translatable too?
I've tried making it work for Widgets by following the github docs and doing the following listed below.
mysite.yml
Silverstripe\SiteConfig\SiteConfig:
extensions:
- TCM\SiteConfig\Extensions\LdaUrlExtension
- TractorCow\Fluent\Extension\FluentExtension
SiteTree:
extensions:
- TractorCow\Fluent\Extension\FluentFilteredExtension
Widget:
extensions:
- TractorCow\Fluent\Extension\FluentVersionedExtension
translate:
- HTMLTitle
- HTMLContent
ContentWidget:
extensions:
- TractorCow\Fluent\Extension\FluentVersionedExtension
translate:
- HTMLTitle
- HTMLContent
Page:
translate:
- 'Heading'
- 'Description'
---
Name: myfluentconfig
---
TractorCow\Fluent\Extension\FluentDirectorExtension:
disable_default_prefix: false
---
Name: fluentfieldconfig
---
TractorCow\Fluent\Extension\FluentExtension:
field_include:
- Varchar(100)
- DBHTMLText
- HTMLTitle
- HTMLContent
PHP in widget.php or contentwidget.php
private static $db = array(
'HTMLTitle' => 'HTMLVarchar',
'HTMLContent' => 'HTMLText',
'PreviewBgImg' => 'HTMLText',
'TextPosition' => 'Varchar(6)',
'TextColour' => 'Varchar(5)',
'BackgroundColour' => 'Varchar(5)'
);
private static $translate = [
'HTMLTitle',
'HTMLText',
'HTMLContent'
];
I expected these to make my content widget fields also translatable but unfortunately widget content is still the same for all locales.
I've also made sure to do dev/build?flush=all and manually even cleared contents of silverstripe-cache folder.
Any help would be appreciated. Thank you.