22 lines
515 B
PHP
22 lines
515 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Jinove\Vinoteca;
|
|
|
|
class Language
|
|
{
|
|
public static function url(string $language): string
|
|
{
|
|
global $APPLICATION;
|
|
|
|
$languages = Config::languages();
|
|
$path = (string)$APPLICATION->GetCurPage(false);
|
|
if (SITE_DIR !== "/" && str_starts_with($path, SITE_DIR)) {
|
|
$path = "/" . substr($path, strlen(SITE_DIR));
|
|
}
|
|
|
|
return Config::host() . rtrim((string)($languages[$language]["dir"] ?? "/"), "/") . $path;
|
|
}
|
|
}
|