Skip to content

What's the best way to deal with more complex locales like 'ch-fr'? #69

Open
@gpluess

Description

@gpluess

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:

'supported-locales' => [
  'ch-de', 'ch-fr', 'ch-it', 'ch-en',
  'de-de', 'de-en',
  'at-de', 'at-de',
],

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 and at-de. Having only one de 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:

'supported-locales' => [
  'de' => [
    'ch-de',
    'de-de',
    'at-de',
  ],
  'en' =>  [
    'ch-en',
    'de-en',
    'at-en',
  ],
  'fr' =>  [
    'ch-fr',
  ],
],

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions