Giter VIP home page Giter VIP logo

translatable's People

Contributors

atmonshi avatar danharrin avatar khant-nyar avatar mnurullahsaglam avatar toxageek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ivl04

translatable's Issues

Validation issue on locale switch

I have used this repository to store multi-language data in JSON datatype. After switching from the base plugin to this repository, I encountered an issue with the locale switch.

Steps to Reproduce:
Add a translation field with required validation.
Enter data in the default language (in my case, English).
Save the data to ensure it is stored.
Switch to another language using the locale switcher option.
Switch back to English.
At this point, the data from the English field is lost, resulting in a validation error.

bubble: (https://app.usebubbles.com/iXL1hc6n5nFRZs3T9JPDLZ/spatie-translatable-plugin-issue-on-locale-switcher)

if bubble expire you can refer ss
screenshot :

https://img.enacton.com/ShareX/2024/06/chrome_yfcctbhrrP.png
https://img.enacton.com/ShareX/2024/06/chrome_tSzQ1NmeiL.png
https://img.enacton.com/ShareX/2024/06/chrome_GyxtZvhLyv.png

Compatibility with relationship to translatable models

Problem description:

In v3.2.81, translatable models with a relationship to another translatable model don't get that relationship's data updated on locale change via the language switch.

Expected Behavior:

It should switch to the translated version of the content for that relationship

Potential solution:

In my PR I had encountered that issue, and using $this->form->getState(false) fixed it.

Versions:

  • filament/filament 3.2.81
  • filament/spatie-laravel-translatable-plugin 3.2.81
  • ralphjsmit/laravel-filament-seo 1.3.2
  • z3d0x/filament-fabricator 2.2.2

Setup:

  • \App\Models\Overrides\Page extends \Z3d0X\FilamentFabricator\Models\Page and uses \RalphJSmit\Laravel\SEO\Support\HasSEO as well as Spatie\Translatable\HasTranslations (NB: the seo property is not part of the $translatable array since it's a relationship and not a db column)
  • \App\Models\Overrides\SEO extends \RalphJSmit\Laravel\SEO\Models\SEO and uses Spatie\Translatable\HasTranslations
  • \App\Filament\Resources\PageResource extends \Z3d0X\FilamentFabricator\Resources\PageResource, uses Filament\Resources\Concerns\Translatable and all related pages are properly overridden and configured
  • A (filament) section for the seo relationship is displayed on the (edit or create) page, its translatable attributes are editable thanks to the section's schema

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.