Using different language domains when on localhost

Hello!

I’m running into problems when deploying my Kirby site to the webserver. This is because I use different domains for different languages.

en.php for web server:

<?php

return [
    'code' => 'en',
    'default' => true,
    'direction' => 'ltr',
    'locale' => [
        'en_US'
    ],
    'name' => 'English',
    'translations' => [
        'minutes' => ' min.',
        'printnow' => 'PRINT NOW'
    ],
    'url' => 'https://www.escape-team.com'
    //'url' => NULL
];

en.php for localhost:

<?php

return [
    'code' => 'en',
    'default' => true,
    'direction' => 'ltr',
    'locale' => [
        'en_US'
    ],
    'name' => 'English',
    'translations' => [
        'minutes' => ' min.',
        'printnow' => 'PRINT NOW'
    ],
    'url' => NULL
];

(and a similar setup for .de, as I use escape-team.de for the German version.)

My question: can I have a “localhost-dependent” variant of or in that file?

Thank you!
Fabian

You could set the url depending on domain:

<?php
$url = ($_SERVER['HTTP_HOST'] === 'localhost') ? null : 'https://www.escape-team.com';
return [
    'code' => 'en',
    'default' => true,
    'direction' => 'ltr',
    'locale' => [
        'en_US'
    ],
    'name' => 'English',
    'translations' => [
        'minutes' => ' min.',
        'printnow' => 'PRINT NOW'
    ],
    'url' => $url
];

Good idea, thanks!