Closed beshoo closed 1 year ago
To me, it seems that that approach is valid, but to me it doesn't make sense to have both approached in one package (we like to keep our packages very simple).
Feel free to create your own separate package where you implemented translations using a one-to-many relation.
Dear Spatie Team,
I am proposing an enhancement to the "https://github.com/spatie/laravel-translatable" package that would be incredibly beneficial to Laravel developers. As a current user of the package, I have faced certain challenges with the existing method of saving translations in Laravel, specifically with translations stored in a JSON format within a field.
One of the major issues I've encountered is that if the package is removed, the website will display JSON instead of translated content. Additionally, it can be quite challenging to access and modify translations, especially for the "NAME" field in Laravel Nova, which can be located beyond the resource form, making it difficult to reach breadcrumbs, user menus, and form details titles, among other things.
To solve these problems, I propose adding a One-to-Many (Polymorphic) relationship as an option in the "https://github.com/spatie/laravel-translatable" package. This approach would allow translations to be saved in a separate module while maintaining the main module string. While this technique may increase performance overhead, the use of caching can mitigate any potential issues.
By utilizing caching, the performance impact of the One-to-Many (Polymorphic) relationship can be significantly reduced, making it a viable option for developers using the "https://github.com/spatie/laravel-translatable" package.
Existing users can continue to use the current implementation, while new users will have the option to use the One-to-Many (Polymorphic) relationship, which can greatly simplify the process of accessing and modifying translations in Laravel.
I am confident that this enhancement will significantly benefit Laravel developers and further establish the "https://github.com/spatie/laravel-translatable" package as an invaluable resource.
Thank you for taking the time to consider my proposal, and I am eagerly anticipating your thoughts on this matter.
Sincerely,