<?php

declare(strict_types=1);

namespace Signocore\Multilanguage\Infrastructure\Hooks;

if (!defined('ABSPATH')) {
	exit;
}

use Signocore\Multilanguage\Features\LanguageDetection;
use Signocore\Multilanguage\Features\LanguageManager;
use Signocore\Multilanguage\Features\LanguageSwitcher;
use Signocore\Multilanguage\Features\StringTranslation;
use Signocore\Multilanguage\Infrastructure\Database\TranslationRepository;
use Signocore\Multilanguage\Infrastructure\Traits\Singleton;
use Signocore\Multilanguage\Support\TranslationHelper;

/**
 * Registers global template functions and public hooks for theme/plugin developers.
 */
final class PublicAPI
{
	use Singleton;

	protected function init(): void
	{
		$this->registerTemplateFunctions();
	}

	private function registerTemplateFunctions(): void
	{
		if (function_exists('signocore_ml_get_current_language')) {
			return;
		}

		require_once __DIR__ . '/template-functions.php';

		// Load WPML-compatible filters only when WPML is not active.
		if (!defined('ICL_SITEPRESS_VERSION')) {
			require_once __DIR__ . '/wpml-compat.php';
		}
	}
}
