area17 / twill

Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.
https://twillcms.com
Apache License 2.0
3.71k stars 567 forks source link

fix: Allow file fields to be non translatable #2529

Open zeezo887 opened 5 months ago

zeezo887 commented 5 months ago

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

Tofandel commented 5 months ago

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

Lets not make the API more confusing shall we

ifox commented 3 months ago

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.