Translatable files field_type?
Created 6 years ago by vargvinter

Hello,

@ryanthompson How to handle translatable files? Is it possible out od the box?

dominique  —  6 years ago

This is currently not possible, there has been an open issue about it for awhile, which labeled as feature instead of bug for some reason: https://github.com/pyrocms/pyrocms/issues/4622

A possible, but not so pretty, temporary fix would be this:

<img src="{{ attribute(page, 'image_'~ config('app.locale')).viewPath }}">

If the current locale is english it'll look for the variable

page.image_en

if it's dutch it'll look for

page.image_nl

That way you can create a separate image field for each language.

vargvinter  —  6 years ago

@dominique Thank you for your response. Of course this works but it is not very pretty. Maybe you know any custom filed type which handles this problem?