statamic / ideas

💡Discussions on ideas and feature requests for Statamic
https://statamic.dev
30 stars 1 forks source link

Retrieve the localized value of any field for any site #1065

Open stuartcusackie opened 8 months ago

stuartcusackie commented 8 months ago

I have an unusual problem here. We want to show a localized value for a field from a different locale than the current - i.e. we want to show multiple localized versions of a single field on a single page.

For example, in our English website we want to show the Irish translation for that field underneath the current localized version: Welcome Fáilte

I have the Statamic/Field/Value for the Text field that contains 'Welcome', but I want to retrieve the Irish version (Fáilte), while still in the current website.

This functionality may exist already but I can't find it in the docs or in the code. I tried a custom solution that retrieves the entire localized entry via the entry origin, but then it gets very complicated as these fields are nested in replicators.

I was hoping for something like $field->localizedValued('irish');

Thanks!