pmochine / Laravel-Tongue

🎉 Finally a subdomain localization that works how you want it to work. 🌐
MIT License
40 stars 7 forks source link

Use custom subdomain instead of locale string? #16

Closed exophunk closed 5 years ago

exophunk commented 5 years ago

This package looks very promising! I have one question though, is it possible to use custom subdomains? I would like to use

gewinnen.domain.com --> "de" gagner.domain.com --> "fr",

so not actually having the locale string in the domain, but I would need to map this to the specific locale somehow?

Thanks,

Robert

pmochine commented 5 years ago

I thought about this. But no. Currently, it's not possible! But I really love the idea.

I'm trying to implement this and I will write back to you.

Thank you :)

pmochine commented 5 years ago

Hey Robert, finally I found some time for it. I restructured the whole code a bit, but try if it works for you now.

For your case you just need to add this in the config localization file:

'aliases' => [
    'gewinnen' => 'de', //important: it has to match with an active locale from the supportedLocales list
    'gagner' => 'fr'
],