laravel-localized-routes icon indicating copy to clipboard operation
laravel-localized-routes copied to clipboard

Use domains and slugs at the same time

Open ivanvermeyen opened this issue 5 years ago • 0 comments

Enable the combined use of localized domains and slugs.

Fictional use case:

Locale URL Description
en https://example.be/en English
nl https://example.be/nl Dutch
nl_BE https://example.be/nl Belgium, Dutch
fr_BE https://example.be/fr Belgium, French
nl_NL https://example.nl/ Netherlands, Dutch (no slug)
fr_FR https://example.fr/ France, French (no slug)

Possible configuration (related to suggested configuration in #20):

'supported-locales' => ['en', 'nl', 'nl_BE', 'fr_BE', 'nl_NL', 'fr_FR'],

'domains' => [
    'en' => 'example.be',
    'nl' => 'example.be',
    'nl_BE' => 'example.be',
    'fr_BE' => 'example.be',
    'nl_NL' => 'example.nl',
    'fr_FR' => 'example.fr',
],

'slugs' => [
    'en' => 'en',
    'nl' => 'nl',
    'nl_BE' => 'nl',
    'fr_BE' => 'fr',
    'nl_NL' => null, // no slug
    'fr_FR' => null, // no slug
],

This is just a first idea of how this might look. Will need to work out if any misconfigurations can happen (we need to be able to detect the locale based on the URL) and how to handle that.

ivanvermeyen avatar Jan 17 '20 16:01 ivanvermeyen