twill icon indicating copy to clipboard operation
twill copied to clipboard

fix: Allow file fields to be non translatable

Open zeezo887 opened this issue 1 year ago • 2 comments

Description

This addresses the issue where setting the translatable(false) method on a file field does not affect the field (i.e. Always translated) by adding a new disableTranslate() method on the file field.

Usage:

Files::make()
    ->name('single_file')
    ->label(twillTrans('Single file'))
    ->disableTranslate();

Related Issues

Fixes #1712

zeezo887 avatar Mar 08 '24 11:03 zeezo887

Why create a new disableTranslate when there is already translatable(false)?

Lets not make the API more confusing shall we

Tofandel avatar Apr 01 '24 10:04 Tofandel

Let me clarify this. We can agree this is not pretty, but it is temporary to avoid a breaking change.

In https://github.com/area17/twill/pull/2525 I asked @zeezo887 to add a new option to work around the current situation with the translate prop on medias field that isn't working because of the global configuration option. Similarly, the files field currently forces translations without any ability to control it globally or at the field level.

To avoid breaking changes in Twill 3 while enabling the missing functionality we introduce these temporary methods. In a future breaking release we will fix the behavior of the translate prop and translatable method, remove the global configuration option for medias fields, as well as these unnecessary methods.

ifox avatar May 23 '24 23:05 ifox