diff --git a/src/Mapper/Entry.php b/src/Mapper/Entry.php
index d539fe4..9018a7e 100644
--- a/src/Mapper/Entry.php
+++ b/src/Mapper/Entry.php
@@ -98,7 +98,8 @@ class Entry extends BaseTaggedMapper
$fields[$name][$locale] = $this->formatValue(
$field->getType(),
$value,
- $field->getItemsType()
+ $field->getItemsType(),
+ $locale
);
}
}
@@ -146,7 +147,7 @@ class Entry extends BaseTaggedMapper
*
* @return mixed
*/
- private function formatValue(string $type, $value, string $itemsType = null)
+ private function formatValue(string $type, $value, string $itemsType = null, string $locale = null)
{
// Certain fields are already built as objects (Location, Link, DateTimeImmutable)
// if the entry has already been built partially.
@@ -161,8 +162,8 @@ class Entry extends BaseTaggedMapper
switch ($type) {
case 'Array':
- return array_map(function ($value) use ($itemsType) {
- return $this->formatValue((string) $itemsType, $value);
+ return array_map(function ($value) use ($itemsType, $locale) {
+ return $this->formatValue((string) $itemsType, $value, $locale);
}, $value);
case 'Date':
return new DateTimeImmutable($value, new \DateTimeZone('UTC'));
@@ -171,7 +172,7 @@ class Entry extends BaseTaggedMapper
case 'Location':
return new Location($value['lat'], $value['lon']);
case 'RichText':
- return $this->richTextParser->parse($value);
+ return $this->richTextParser->parseLocalized($value, $locale);
default:
return $value;
}
Steps to reproduce
Expected Result
The title of the image present in the Body of the Blog Post should be in Italian
Actual Result
The title of the image present in the Body of the Blog Post is in English
Considerations
Take a look to this issue patched on
contentful/rich-text.phprepository. You can patch this module like this: