Different Multilanguage Setup

Hi there, we want to build the following URLs for a new Website.
example.com/us/en
example.com/us/es
example.com/tr/tr

I haven’t found a solution for this. Maybe someone has build this and can give me a hint how to solve this and using the native features of Kirbys translation / language feature. The first folder will represent the Country and the second the language. I think it will only work if we disable automatic language detection.

We will create a country folder - related to user permissions with the bouncer plugin. We plan also a javascript detection for the prefered language to show a small banner if the users lands on example.com

PS: Deleted my question on Discord. :wink:

It would be relatively easy to create the url structure via routes, if it wasn’t for the fact that one language could exist more than once, us/en, gb/en etc.

Using folders for the countries would result in using the language feature.

Tricky.

Thanks for your fast reply. :heart_eyes:

I am not against the language feature. And if we made general translations for en its totally fine to use the same english in uk and us. So the country folder will always redirect to the main / first language. We will have more than one language in different countries. so do you think this will work out with routes?

For general translations that might work, but the problem would arise when working with country specific stuff like prices etc, after all, it should probably still work when requirements change.

I don’t really have a definite answer for you, just trying to come up with ideas. If you move content into country folders, you would basically lose Kirby’s translation feature in the Panel, because you don’t want to translate tr/tr to English etc.

I just had a late night idea, and it seems to be very easy, after all, just set the url option in the language:

<?php

return [
    'code' => 'en-gb',
    'default' => false,
    'direction' => 'ltr',
    'locale' => [
        'LC_ALL' => 'en_GB'
    ],
    'name' => 'English-GB',
    'translations' => [

    ],
    'url' => '/gb/en'
];
<?php

return [
    'code' => 'en',
    'default' => true,
    'direction' => 'ltr',
    'locale' => [
        'LC_ALL' => 'en_US'
    ],
    'name' => 'English',
    'translations' => [

    ],
    'url' => '/us/en'
];
1 Like