Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization Support #75

Closed
MaartenJC opened this issue Jul 4, 2023 · 8 comments
Closed

Localization Support #75

MaartenJC opened this issue Jul 4, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@MaartenJC
Copy link

I use Fabricator with Spatie Translatable.
So slugs are stored like:
{"nl":"test-nl","de":"test-de"}

When the Dutch locale is set, the pageUrls are like this:
$pageUrls[1] = "/test-nl"

This is Cached with the key:
filament-fabricator::page-urls

When the German page is requested, the Dutch $pageUrls are returned so no page is found.

@Z3d0X
Copy link
Owner

Z3d0X commented Jul 8, 2023

I don't think this package is compatible with spatie translatable

@MaartenJC
Copy link
Author

It actually works great except for this problem. So would it be an option to modify te code from:
$pageUrls = FilamentFabricator::getPageUrls();
to:
$pageUrls = FilamentFabricator::getPageUrls($locale);

@Z3d0X
Copy link
Owner

Z3d0X commented Jul 10, 2023

Ok I will look in to this for future updates

@Nestoran
Copy link

Nestoran commented Aug 1, 2023

Has this been implemented already? Any news on this?

@Voltra
Copy link
Contributor

Voltra commented Nov 26, 2023

Hi there! I have been able to use Spatie Translatable with Fabricator.

I've done this by simply overriding FilamentFabricatorManager#setPageUrl as well as the routing and the route parameter binding. Just to ensure everything works smoothly, I also added a locale detector middleware.

@Voltra
Copy link
Contributor

Voltra commented Nov 26, 2023

I've made a gist for that: https://gist.github.com/Voltra/191666f4af51e42528e54bfc682661e9

@Z3d0X
Copy link
Owner

Z3d0X commented Nov 26, 2023

@Voltra I'd be open to a PR on this as a opt-in feature. (eg: needs to be enabled in the config to use it)

@Z3d0X Z3d0X changed the title Cache in getPageUrls() is not Locale aware Localization Support Nov 26, 2023
@Z3d0X Z3d0X added the enhancement New feature or request label Nov 26, 2023
@Z3d0X
Copy link
Owner

Z3d0X commented Feb 6, 2024

As described in this comment #119 (comment) localization is better off as a project side configuration

@Z3d0X Z3d0X closed this as not planned Won't fix, can't repro, duplicate, stale Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants