Open gpluess opened 1 year ago
Hello,
That's an interesting idea. It is like the recent PR #70 but instead of a single prefix/slug, you want multiple slugs.
Now, I've been thinking about this for a short while and found a few complications... Mainly I think I need to figure out a new and better way to map all the locale parts together in a flexible, yet not to complicated way. Also related to #20 and #21, but those ideas are not fully worked out yet either.
A slug in the URL needs to be connected to a locale for route names and translations (a sort of internal locale).
But when you generate a route('some-route')
, this also needs to know what slug to use. That is currently not possible if multiple are connected to a single internal locale. So I think the slugs might need to become the source of truth, the unique "key" when looking up locale configurations.
I still need to work this out further, but I will certainly include your suggestion in the final result.
I have a requirement to include the locale AND the country in the URL like this:
/ch-fr/entreprises
/de-en/companies
/at-de/unternehmen
I am also going to have multiple countries with the same locale:
/ch-de/unternehmen
/de-de/unternehmen
/at-de/unternehmen
This basically works by setting the
supported-locales
config value to something like this:However, I think this has some disadvantages, for example, now I have to have 3 versions for German in the
lang
directory and keep them in sync:ch-de
,de-de
andat-de
. Having only onede
directory no longer works. Other third party packages like spatie/laravel-translatable do not work well with this approach.In order to avoid duplication, I would have proposed a syntax like this:
But I guess this would break the domains/subdomains feature. So I'm wondering what's the best approach to deal with this?
Any suggestions are highly appreciated!