Generic translation engine.
Reads one or more properties from an upstream element, translates each value (string, list of strings, or weighted list of strings) into the language resolved from request evidence, and writes the translated values under this engine's element data key.
The locale is resolved from the evidence keys (in precedence order) query.translation, query.accept-language, header.accept-language, unless a fixed language is configured. See Languages::tryResolveLocale for the resolution rules, including the English short-circuit.
|
| | __construct (string $elementDataKey, string $sourceElementDataKey, array $propertyMap, array $localeMaps, ?string $fixedLanguage=null, string $behavior=MissingTranslationBehavior::ORIGINAL) |
| | getEvidenceKeyFilter () |
| | Function for getting the FlowElement's EvidenceKeyFilter Used by the filterEvidence method.
|
| | processInternal (FlowData $flowData) |
| | Process FlowData - this is process function is usually overridden by specific FlowElements to do their core work.
|
| | getDataSourceTier () |
| | Get the tier to which the current data source belongs.
|
| | setCache (DataKeyedCache $cache) |
| | Add a cache to an engine.
|
| | setRestrictedProperties (array $propertiesList) |
| | Add a subset of properties.
|
| | inCache (FlowData $flowData) |
| | A method to check if a flowData's evidence is in the cache.
|
| | process (FlowData $flowData) |
| | Engine's core process function.
|
| | __construct () |
| | A default dummy constructor is needed for there are classes inheriting this class deeper than 1-level of inheritance and calling parent::__construct() in their explicit constructors.
|
| | filterEvidence (FlowData $flowData) |
| | Filter FlowData evidence using the FlowElement's EvidenceKeyFilter.
|
|
| filterEvidenceKey (string $key) |
| | Filter FlowData evidence using the FlowElement's EvidenceKeyFilter.
|
| | onRegistration (Pipeline $pipeline) |
| | Callback called when an engine is added to a pipeline.
|
| | getProperties () |
| | Get properties Usually overridden by specific FlowElements.
|
|
| updatePropertyList () |
| | Update a FlowElement's property list This is used by elements that are only aware of their properties at a later stage, such as cloud request based FlowElements or FlowElements that change their properties later based on new datafiles.
|
| fiftyone\pipeline\translation\TranslationEngine::buildTranslatedProperties |
( |
FlowData | $flowData, |
|
|
Translator | $translator ) |
|
protected |
Translate every mapped property and return the result keyed by lower-cased destination property name.
Subclasses can call this, add further properties, and then set the element data themselves.
- Returns
- array<string, AspectPropertyValue>
| fiftyone\pipeline\translation\TranslationEngine::getEvidenceKeyFilter |
( |
| ) |
|
Function for getting the FlowElement's EvidenceKeyFilter Used by the filterEvidence method.
Reimplemented from fiftyone\pipeline\core\FlowElement.
| fiftyone\pipeline\translation\TranslationEngine::processInternal |
( |
FlowData | $flowData | ) |
|
Process FlowData - this is process function is usually overridden by specific FlowElements to do their core work.
Reimplemented from fiftyone\pipeline\core\FlowElement.
Reimplemented in fiftyone\pipeline\ipintelligence\translation\CountriesTranslationEngine.
| fiftyone\pipeline\translation\TranslationEngine::resolveTranslator |
( |
FlowData | $flowData | ) |
|
|
protected |
Resolve the translator and locale to use for this request.
- Returns
- array{translator: Translator, locale: null|string}