silverstripe/silverstripe-forager-fluent

Fluent (translations) support for silverstripe/silverstripe-forager

1.0.0-beta.1 2025-09-10 23:19 UTC

This package is auto-updated.

Last update: 2025-09-11 01:41:02 UTC


README

Support for the fluent module.

This module sets the Locale context for indexing operations. The core assumption is that one index has content from one locale. I does this with IndexDataContextProvider implementations to set the Locale context for indexing operations. Refer to the index context documentation for more information.

Install with composer require silverstripe/forager-fluent.

To configure add the fluent context and a locale property to your index configurations:

SilverStripe\Forager\Service\IndexConfiguration:
  indexes:
    main:
      context: fluent
      locale: en_NZ
      includeClasses:
        ...
    mi:
      context: fluent
      locale: mi_NZ
      includeClasses:
        ...

This will use the default fluent context created by this module to set the locale. It will also use the LiveIndexDataContext from the forager module as seen in the configuration below:

---
Name: forager-fluent-context
---
SilverStripe\Core\Injector\Injector:
  SilverStripe\Forager\Service\IndexData:
      properties:
        contexts:
          fluent:
            SilverstripeForagerLiveIndexDataContext: '%$SilverStripe\Forager\Service\LiveIndexDataContext'
            SilverstripeForagerLocaleIndexDataContext: '%$SilverStripe\ForagerFluent\Service\LocaleIndexDataContext'

You can customise this context by overriding it in yaml or providing a new custom index context implementation.

Search service extension

This module will replace the SearchServiceExtension provided by the forager module. The replacement extension will create a job for each locale (and therefore index) an object has a localisation for.